package cmarkit

  1. Overview
  2. Docs
CommonMark parser and renderer for OCaml

Install

dune-project
 Dependency

Authors

Maintainers

Sources

cmarkit-0.4.0.tbz
sha512=4f0be18c1a16265710d20b85e48b3f8d8632dd708f413264f2a3b7653a860fd80440b81dc40f5ec63d63411705ae389bb07bdb74365e277bec24895b44ba8a0a

doc/cmarkit/Cmarkit/Block/index.html

Module Cmarkit.BlockSource

Blocks.

Blocks

Sourcetype t = ..

The type for blocks.

Sourcemodule Blank_line : sig ... end

Blank lines.

Sourcemodule Block_quote : sig ... end

Block quotes.

Sourcemodule Code_block : sig ... end

Code blocks.

Sourcemodule Heading : sig ... end

Headings.

Sourcemodule Html_block : sig ... end

HTML blocks.

Sourcemodule List_item : sig ... end

List items.

Sourcemodule List' : sig ... end

Lists.

Sourcemodule Paragraph : sig ... end

Paragraphs.

Sourcemodule Thematic_break : sig ... end

Thematic breaks.

Sourcetype t +=
  1. | Blank_line of Blank_line.t node
  2. | Block_quote of Block_quote.t node
  3. | Blocks of t list node
    (*

    Splicing

    *)
  4. | Code_block of Code_block.t node
  5. | Heading of Heading.t node
  6. | Html_block of Html_block.t node
  7. | List of List'.t node
  8. | Paragraph of Paragraph.t node
  9. | Thematic_break of Thematic_break.t node

The CommonMark leaf and container blocks.

Sourceval empty : t

empty is Blocks ([], Meta.none).

Extensions

See the description of extensions.

Sourcemodule Table : sig ... end

Tables.

Sourcemodule Footnote : sig ... end

Footnotes.

Sourcetype t +=
  1. | Ext_math_block of Code_block.t node
  2. | Ext_table of Table.t node
  3. | Ext_footnote_definition of Footnote.t node

The supported block extensions. These blocks are only parsed when Doc.of_string is called with strict:false.

Functions on blocks

Sourceval meta : ?ext:(t -> Meta.t) -> t -> Meta.t

meta ~ext b is the metadata of b.

ext is called on cases not defined in this module. The default raies Invalid_argument.

Sourceval normalize : ?ext:(t -> t) -> t -> t

normalize b has the same content as b but is such that for any occurence of Blocks (bs, _) in b the list of blocks bs:

  1. bs is not a singleton list.
  2. Has no Blocks _ case. The meta is dropped and the nested blocks are spliced in bs where the case occurs.

ext is called on cases not defined in this module. The default raises Invalid_argument.

Sourceval defs : ?ext:(Label.defs -> t -> Label.defs) -> ?init:Label.defs -> t -> Label.defs

defs b collects b's Link_reference_definition and Ext_footnote_definition and for those that have a label definition (see Link_definition.defined_label and Footnote.defined_label) adds them to init (defaults to Label.Map.empty).

ext is called on cases not defined in this module. The default raises Invalid_argument.