package yocaml_cmark
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=cfd4291358e4bd9a90c5926bbb770b898c30ce7c25ce02bb9548803392d16d72
sha512=57ae20ea44c7ff456c647e883eb9649c77f8786b895cd5318e617e836340f0a0631cba2234a5e5e2b7565e862a0085efba98b001e5ddb7ba51b2f557e47a4224
doc/yocaml_cmark/Yocaml_cmark/index.html
Module Yocaml_cmark
Source
Describing documents using a Markup language is very common in the Blogosphere (rather than describing all the formatting of document content in HTML, using <p>, <strong> and co).
Common Mark
is a very popular markup language (did you get the joke, up/down) and, fortunately, OCaml has several one very good libraries for turning Common Mark into HTML. This library is a wrapper around cmarkit, an excellent Common Mark conversion library.
CommonMark is a specification (see RFC7763/RFC7764) of Markdown since 2016. As Markdown, it's a popular markup language and an implementation in OCaml exists: cmarkit.
API
An arrow that produces an HTML (as a String) from a String in Common Mark.
The strict
argument permits to follow only the CommonMark specification. If you attempt to use some extensions (see Cmarkit.Doc.of_string
), you should set it to false
.
Since it is pretty common to deal with document and Metadata, which are generally a pair of Metadata
and the content of the document
, content_to_html
is a function that produce an arrow which apply the Common Mark conversion on the second element (the content).
content_to_html ()
is equivalent of Yocaml.Build.snd to_html
.