ocaml / omd

extensible Markdown library and tool in "pure OCaml"
ISC License
156 stars 45 forks source link

Add missing tag 1.3.1 (and question about `Omd.to_html ?override`) #239

Closed erikmd closed 3 years ago

erikmd commented 3 years ago

Dear Omd maintainers,

when working on learn-ocaml (which happens to rely on Omd), we were looking for some ocamldoc documentation for Omd, and then we realized that in this upstream repository, the latest 1.x releases (1.2.6, 1.3.0, 1.3.1) mentioned in https://opam.ocaml.org/packages/omd/ are not part of this repository; it took me some time to figure out that, e.g., the tag 1.3.1 is part of @Chris00's fork: https://github.com/Chris00/omd/tags

So to make the code more discoverable, would you agree to integrate (from a git perspective) this tag 1.3.1 in your upstream repo?

Side-question: we are now using the override optional argument of Omd.to_html:

Omd.to_html : ?override:(Omd_representation.element -> string option) -> ?pindent:bool -> ?nl2br:bool -> ?cs:Omd.code_stylist -> Omd.t -> string

which does not seem to be available in master; do you think it'd be feasible to provide a similar feature for this override optional argument in Omd 2.x?

(Specifically, we are interested in generating HTML output from some Markdown, while ensuring that each link opens a new window/tab, i.e., they are in the form <a href="URL" target="_blank" rel="noopener noreferrer">s</a>.)

Thanks for maintaining this nice library! :)

sonologico commented 3 years ago

Hi, erikmd,

I'll pull that tag into this repository. Thanks for bringing it up.

I'll also take a look at the override implementation and get back to you about it.

sonologico commented 3 years ago

Hi, @erikmd

Would you be able to get the same effect by writing a function from Omd.doc to Omd.doc that maps the markdown node for which you need a custom output to a markdown html node with the representation you want? Then you would call to_html on the result.

erikmd commented 3 years ago

Hi @sonologico, indeed that looks a good way, thanks. I'm swamped these days but I believe I could this in learn-ocaml once omd 2.0.0 is released. Thanks again, and feel free to close this issue from now on.