md2mld icon indicating copy to clipboard operation
md2mld copied to clipboard

Support for blockquotes

Open Niols opened this issue 4 years ago • 4 comments

Hey there,

Thank you very much for this tool; very handy!

Would it be possible to add support for Markdown's blockquotes? Currently, I think md2mld doesn't do much with them, which leads to remaining > characters in the output HTML file (as processed with odoc). I am not sure if there is such a thing as blockquotes in MLD files, but then maybe at least remove the > files?

I don't have the time right now but I could try working on a PR adding this in a few months, if you wanted.


Example blockquotes:

Here comes a quote:

> Here is the quote.

Here comes another quote with a nested quote:

> Here is the quote.
> 
> > Here is the nested quote.

Bye!

which shows as follows, on GitHub:

Here comes a quote:

Here is the quote.

Here comes another quote with a nested quote:

Here is the quote.

Here is the nested quote.

Bye!

Niols avatar May 28 '21 10:05 Niols

I have taken a look at the syntax of ocamldoc comments (odoc and ocamldoc share the same syntax) and there does not seem to be any way to quote a text. In the code of odoc, one can see a suggestion to use "raw HTML" as follows:

{%html:
        <blockquote>
          If the raw HTML is the only thing in a paragraph, it is treated as a block
          element, and won't be wrapped in paragraph tags by the HTML generator.
        </blockquote>
   %}

However, this does not seem so satisfying as it will only work with HTML and there is then no way to use the other markups from ocamldoc's syntax.

Niols avatar May 28 '21 15:05 Niols

Yes, I think I had thought about it at the time and could not find a satisfactory solution. The code that deals with it is

https://github.com/mseri/md2mld/blob/97ae31f54190971b0ac685620095093993a76447/src/backend.ml#L90-L93

Where quote is used to re-add manually the ">"

mseri avatar May 28 '21 15:05 mseri

We could replace my handcrafted > with two consecutive (redundant) blocks. One in latex using the quote environment and one in html using the blockquotes environment. It will not be nice to see in the sources, but it should produce the correct html and tex/pdf. This would be a relatively simple change to add

mseri avatar May 31 '21 19:05 mseri

I am generating the html form for now. It would not be hard to pass a context to choose between latex-ready or html-ready output though

mseri avatar Jun 25 '21 08:06 mseri