[ocaml-infra] markdown in "pure" OCaml

Philippe Wang philippe.wang at cl.cam.ac.uk
Wed Aug 7 19:18:29 BST 2013


On 7 Aug 2013, at 14:50, Christophe TROESTLER <Christophe.Troestler at umons.ac.be> wrote:

> On Wed, 7 Aug 2013 13:58:16 +0100, Philippe Wang wrote:
>> 
>> Lately I realised that there are actually two markdown render engines
>> on github: the one that is officially "GFM" (github flavoured
>> markdown), which is used for issues, comments and pull requests, and
>> the other one, which is somehow closer to standard markdown, that is
>> used to render .md files in repos when you click on them (e.g., any
>> .md file in https://github.com/pw374/sandbox/).
>> 
>> So I've decided that by default, omd should do standard markdown
>> newlines, not GFM's.
>> 
>>>> [gfm_newlines]:
>>>> https://help.github.com/articles/github-flavored-markdown#newlines
> 
> I think this is a good decision.  Line breaks should not be enforced
> for HTML paragraphs as these need to resize well according to the
> browser width, font size,...  Moreover, since links will take more
> space in Markdown than in HTML, it would be cumbersome to format
> paragraphs well if newlines were transformed into <br/>.

Indeed.

> While I am at it, I remember that "extension points" were evoked.
> They are required IMHO if one wants to attach some code to the
> transformation Markdown → HTML.  For example, if one wants to have a
> paragraph or a block of code initially hidden (with a button to make
> it visible).  Is there any design for this ATM?

At this moment (it took me a while to figure out what ATM meant), 
there is no design for what you mention.

On 25 Jul 2013, at 17:08, Thomas Gazagnaire <thomas at gazagnaire.org> wrote that, which I believe is roughly the same thing:
> Last point, I use to have an extension of Mauricio's markdown parser which is able to tag a specific elements with an HTML class (example: @foo{Bla bla} to generate <span class="foo">Bla bla</span>). This is not standard, but very useful when you can tweak the associated CSS, and I'd be very happy if I can add it later to your parser without too much trouble.

Well, eventually omd will parse an extended version of Markdown. Although the code (at least currently) is not very pretty (mainly because it's still the first iteration), I believe it is (already) **very** simple to understand how it's built in order to add one's own extension. Slightly modifying an existing behaviour might not be so trivial.
What I mean is that, if one wants to add a construction such as 
@@foo@@
which would be the equivalent of
<span class="foo">This is a useless extension of Markdown</span>
it's trivial (mainly thanks to OCaml pattern matching).
If one wants to slightly change the parsing of lists, it might be causing headaches…
If one wants to completely rewrite the parsing of lists, well, it will still cause headaches but that would not be because of existing code.

> Best,
> C.


Best,
Philippe




More information about the Infrastructure mailing list