reasonml.org icon indicating copy to clipboard operation
reasonml.org copied to clipboard

Convert the ocaml-manual to Reason flavoured Markdown

Open ryyppy opened this issue 6 years ago • 3 comments

The ocaml-manual is the official handbook for using OCaml. It fully describes all features and syntax elements and is highly valuable for explaining complex mechanisms, such as GADTs or polymorphic variants.

This is an ambitious task, I actually post it here so we don't forget about it. It's also a quite isolated task which will hopefully not interfere with our current work, if you feel like experimenting and have any progress, please let us know in this issue, so we can keep track of it.

What needs to be done?

  • Revive rtop with the most recent Reason version (\cc @jordwalke)
  • Create a mirror of the ocaml-manual repository
  • Use the ocaml manual build system to use rtop instead of utop to output Reason formatted signatures
  • Add refmt for reformatting ml codesnippets in the build system
  • Make the build system expose markdown / json instead of html

Especially the markdown rendering will be useful, since we will then be able to commit the generated markdown output in our existing infrastructure (also makes it easier for us to style).

ryyppy avatar Oct 01 '19 07:10 ryyppy

The manual does not really use a toplevel for building code examples, it has its own caml-tex internal tools that extracts the code example, processes them with compiler-libs and outputs the corresponding latex code block. Adding hooks to caml-tex in order to switch the outcometree printer to reason's printer should not be too hard. Similarly, adding a preprocessing step to the input sounds relatively straightforward.

Octachron avatar Mar 17 '20 12:03 Octachron

As stated by @Octachron in Discord, some projects parse the html output to modify the data. Here the direct quote:

For just postprocessing the manual there is https://sanette.github.io/ocaml-tutorial/4.10/coreexamples.html for instance. I am not sure if the postprocessing pipeline is published

It is : https://github.com/sanette/ocaml-tutorial .

ryyppy avatar Mar 18 '20 19:03 ryyppy

Also, converting to markdown is difficult because the manual source are written in latex and latex is too powerful as a language. However, we (me and @gasche at the very least) have been discussing about trying to convert the source to a less featurefull format to decrease the entry barrier for contributors.

Octachron avatar Mar 18 '20 19:03 Octachron