Cmarkit_renderer.ContextRendering contexts.
type renderer := ttype t = contextThe type for rendering contexts.
make r b is a context using renderer r to render documents on buffer b.
The renderer r must be able to handle any inline, block and document values (i.e. its renderers should always return true) otherwise Invalid_argument may raise on renders.
This means the last renderer you compose with should always have catch all cases returning true; after possibly indicating in the output that something was missed. The built-in renderers Cmarkit_commonmark.renderer, Cmarkit_html.renderer and Cmarkit_latex.renderer do have these catch all cases.
val buffer : t -> Stdlib.Buffer.tbuffer c is the buffer of c.
val get_doc : t -> Cmarkit.Doc.tget_doc c is the document being rendered.
val get_defs : t -> Cmarkit.Label.defsget_defs c is Doc.defs (get_doc c).
module State : sig ... endCustom context state.
val init : t -> Cmarkit.Doc.t -> unitThese function append data to the buffer of the context. For more specialized rendering functions, see the corresponding rendering backends.
val byte : t -> char -> unitbyte c b renders byte b verbatim on c.
val utf_8_uchar : t -> Stdlib.Uchar.t -> unitutf_8_uchar c u renders the UTF-8 encoding of u on c.
val string : t -> string -> unitstring c s renders string s verbatim on c.
val inline : t -> Cmarkit.Inline.t -> unitinline c i renders inline i on c. This invokes the composition of inline renderers of c.
val block : t -> Cmarkit.Block.t -> unitblock c b renders block b on c. This invokes the composition of block renderers of c.
val doc : t -> Cmarkit.Doc.t -> unitdoc c d initializes c with init and renders document d on c. This invokes the composition of document renderers of c.