A markdown parser in OCaml, with no extra dependencies.
This module represents this entire Markdown library written in OCaml only.
Its main purpose is to allow you to use the Markdown library while keeping you away from the other modules.
If you want to extend the Markdown parser, you can do it without accessing any module of this library but this one, and by doing so, you are free from having to maintain a fork of this library.
N.B. This module is supposed to be reentrant, if it's not then please report the bug.
|(*||Header of level 1||*)|
|(*||Header of level 2||*)|
|(*||Header of level 3||*)|
|(*||Header of level 4||*)|
|(*||Header of level 5||*)|
|(*||Header of level 6||*)|
|(*||A Markdown paragraph (must be enabled in of_string)||*)|
# | Text of string
|(*||Ordered (i.e. numbered) list||*)|
# | Br
|(*||(Forced) line break||*)|
# | Hr
# | NL
|(*||Newline character. Newline characters that act like delimiters (e.g. for paragraphs) are removed from the AST.||*)|
# | Html_comment of string
|(*||An HTML comment, including "<!--" and "-->".||*)|
# | Raw of string
|(*||Raw: something that shall never be converted||*)|
# | Raw_block of string
|(*||Raw_block: a block with contents that shall never be converted||*)|
A element of a Markdown document.
Fallback for references in case they refer to non-existant references
Markdown reference name.
HTML img tag attribute.
Function that takes a language name and some code and returns that code with style.
of_string s returns the Markdown representation of the string
Translate markdown representation into raw HTML. If you need a
full HTML representation, you mainly have to figure out how to
Html of string and
Html_block of string
into your HTML representation.
toc md returns
toc a table of contents for
~start:[2;3]will build the TOC for subsections of the second
H1header, and within that section, the third
h2header. If a number is
0, it means to look for the first section at that level but stop if one encounters any other subsection. If no subsection exists, an empty TOC
will be returned. Default:
i.e. list all sections, starting with the first