package yocaml_cmark

  1. Overview
  2. Docs
YOCaml Common Mark processor

Install

Dune Dependency

Authors

Maintainers

Sources

yocaml-1.0.0.tbz
sha256=cfd4291358e4bd9a90c5926bbb770b898c30ce7c25ce02bb9548803392d16d72
sha512=57ae20ea44c7ff456c647e883eb9649c77f8786b895cd5318e617e836340f0a0631cba2234a5e5e2b7565e862a0085efba98b001e5ddb7ba51b2f557e47a4224

doc/yocaml_cmark/Yocaml_cmark/index.html

Module Yocaml_cmarkSource

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

Sourceval to_html : strict:bool -> (string, string) Yocaml.Build.t

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.

Sourceval content_to_html : ?strict:bool -> unit -> ('a * string, 'a * string) Yocaml.Build.t

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.

OCaml

Innovation. Community. Security.