Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for blockquotes #2

Open
Niols opened this issue May 28, 2021 · 4 comments
Open

Support for blockquotes #2

Niols opened this issue May 28, 2021 · 4 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@Niols
Copy link

Niols commented May 28, 2021

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!

@mseri mseri added bug Something isn't working help wanted Extra attention is needed labels May 28, 2021
@Niols
Copy link
Author

Niols commented May 28, 2021

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.

@mseri
Copy link
Owner

mseri commented May 28, 2021

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

md2mld/src/backend.ml

Lines 90 to 93 in 97ae31f

| Blockquote q :: tl ->
Buffer.add_string b (quote ~indent:list_indent (mld_of_md ~min_header q));
if tl <> [] then Buffer.add_string b "\n";
loop list_indent tl

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

@mseri mseri added enhancement New feature or request and removed bug Something isn't working labels May 28, 2021
@mseri
Copy link
Owner

mseri commented May 31, 2021

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 mseri added the good first issue Good for newcomers label May 31, 2021
mseri added a commit that referenced this issue Jun 18, 2021
The interface of odoc has already changed since 2.0.0~alpha1,
this is based on @jfrolich PR ocaml/omd#215
and is intended as an intermediate step to ease the port to the next
release of omd. Issue #5 will not be closed for the time being.

In particular there is a regression in the way we deal with blockquotes.
These need to be addressed anyway, see #2.

Signed-off-by: Marcello Seri <[email protected]>
mseri added a commit that referenced this issue Jun 18, 2021
The interface of omd has already changed since 2.0.0~alpha1,
this is based on @jfrolich PR ocaml/omd#215
and is intended as an intermediate step to ease the port to the next
release of omd. Issue #5 will not be closed for the time being.

In particular there is a regression in the way we deal with blockquotes.
These need to be addressed anyway, see #2.

Signed-off-by: Marcello Seri <[email protected]>
@mseri
Copy link
Owner

mseri commented Jun 25, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants