package cmarkit
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha512=42fa920e84f2b7d45f5cf1251d3308daa7becff2590f7ce84186cb22335415b02cc9bc44179095bf0d37624fb5a0e66d1c96fcc1b12f1106f567247a71c79039
doc/cmarkit/Cmarkit/Doc/index.html
Module Cmarkit.Doc
Documents (and parser).
Documents
val nl : t -> Layout.stringnl d is the first newline found in the text during parsing or "\n" if there was none.
val defs : t -> Label.defsdefs d are the label definitions resulting from parsing d. The result depends on the label definitions found in the source and the defs and resolver values specified on Doc.of_string.
val make : ?nl:Layout.string -> ?defs:Label.defs -> Block.t -> tmake ~nl ~defs b is a document for block b with newline nl (defaults to "\n"), label definition defs (defaults to Label.Map.empty).
val empty : tempty is an empty document.
Parsing
val of_string :
?defs:Label.defs ->
?resolver:Label.resolver ->
?nested_links:bool ->
?heading_auto_ids:bool ->
?layout:bool ->
?locs:bool ->
?file:Textloc.fpath ->
?strict:bool ->
string ->
tof_string md is a document from the UTF-8 encoded CommonMark document md.
- If
strictistrue(default) the CommonMark specification is followed. Iffalsethese extensions are enabled. fileis the file path from whichsis assumed to have been read (defaults toTextloc.file_none), used in theTextloc.tvalues ifflocsistrue.- If
locsistruelocations are stored in nodes of the abstract syntax tree in individually identifiedMeta.tvalues. Iffalse(default) node meta values are allMeta.nonewhose text location isTextloc.none. - If
layoutisfalse(default) layout values cannot be relied upon and do not in general represent source layout, some fields may be normalized. TheBlock.Blank_line,Block.Link_reference_definition,Block.Ext_footnote_definition, layout block values are present in the result regardless of this parameter. - If
heading_auto_idsistrue(defaults tofalse) then`Autoheading identifiers are generated during parsing from the header text withInline.id(at that point noextargument is needed) and made accessible inBlock.Heading.id. Note that the identifiers may not be unique, we leave it to the backends to handle this problem. - If
nested_linksistrue(defaults tofalse) there is no restriction on having links in link text, which is forbidden by CommonMark and HTML. This can be useful for embedding DSLs in link labels or destinations. Note that image links already allow link nesting as per CommonMark specification. - If
resolveris provided this is used resolve label definitions and references. See here for details. Defaults toLabel.default_resolver. - If
defsadds these label definitions to the document (defaults toLabel.Map.empty). Think of them as being prepended tomd. IfresolverisLabel.default_resolver, these take over the same labels defined inmd(first definition takes over in CommonMark).
UTF-8 decoding errors and U+0000 are turned into Uchar.rep characters. Inlines of the result should be Inline.normalized. Blocks of the result should be Block.normalized.
Note. For simple renders parsing with layout:false and locs:false is generally faster; having these to true allocates quite a bit.
Versions
unicode_version is the Unicode version known to of_string.
commonmark_version is the CommonMark version known to of_string.