[ocaml-infra] markdown in "pure" OCaml

Leo White lpw25 at cam.ac.uk
Thu Aug 8 18:37:03 BST 2013


> The 99 problems page is what I was indeed thinking of.  Of course one
> can always resort to HTML in case of need but I think that one shoul
> d take opportunity of the "port" of the page to Markdown to do someth
> ing better.  In particular, the text should be closer to the intended
> semantics if possible, e.g., say
>
>     @Question
>     ...
>     @Solution
>     ...
>     @Examples
>     ...
>     @end
>
> possibly with a line "@use Questions" at the beginning of the file if
> it is deemed desirable to announce explicitly the active extensions for a given page.  I think such an extension
> mechanism is desirable¹⁻ ²⁻³ because it uses the principle of least surprise (syntax wise): on ce you read the
> documentation of the markdown parser, you know what c onstructs refer to outside code.  Otherwise, one may always
> preproces s Markdown files (adding HTML) before passing them to the parser but  several incompatible extensions may
> appear (I'll certainly develop on e for ocaml.org).

These kind of extensions are really best done using a template engine
before the conversion of markdown to HTML. Template engines are designed
to support such extensions, and mean you don't need to pollute your
markdown converter with support for arbitrary syntax extensions.

I think the plan is to build a simple template engine (similar to
mustache, handlebars or liquid) using mpp, and then use that to do the
preprocessing.

Regards,

Leo


More information about the Infrastructure mailing list