Cmarkit.Inline
Inlines.
Note. Document data in inline nodes is always stored unescaped and with entity and character references resolved.
module Autolink : sig ... end
Autolinks.
module Break : sig ... end
Hard and soft breaks
module Code_span : sig ... end
Code spans.
module Emphasis : sig ... end
Emphasis and strong emphasis.
module Link : sig ... end
Links.
module Raw_html : sig ... end
Raw HTML.
module Text : sig ... end
Text.
type t +=
| Autolink of Autolink.t node
| Break of Break.t node
| Code_span of Code_span.t node
| Emphasis of Emphasis.t node
| Image of Link.t node
| Inlines of t list node
Splicing
*)| Link of Link.t node
| Raw_html of Raw_html.t node
| Strong_emphasis of Emphasis.t node
| Text of Text.t node
The CommonMark inlines.
val empty : t
empty
is Inlines ([], Meta.none)
.
See the description of extensions.
module Strikethrough : sig ... end
Strikethrough.
module Math_span : sig ... end
Math span.
The supported inline extensions. These inlines are only parsed when Doc.of_string
is called with strict:false
.
val is_empty : t -> bool
is_empty i
is true
if i
is Inline ([], _)
or Text ("", _)
.
meta ~ext i
is the metadata of i
.
ext
is called on cases not defined in this module. The default raises Invalid_argument
.
normalize i
has the same content as i
but is such that for any occurence of Inlines (is, _)
in i
the list of inlines is
:
is
is not a singleton list.Text _
cases. If that occurs the texts are concatenated, the meta of the first one is kept and its text location extended to include the second one.Inlines _
case. The meta is dropped and the nested inlines are spliced in is
where the case occurs.ext
is called on cases not defined in this module. The default raises Invalid_argument
.
val to_plain_text :
?ext:(break_on_soft:bool -> t -> t) ->
break_on_soft:bool ->
t ->
string list list
to_plain_text ~ext ~break_on_soft i
has the plain text of i
as a sequence of lines represented by a list of strings to be concatenated. If break_on_soft
is true
soft line breaks are turned into hard line breaks. To turn the result r
in a single string apply:
String.concat "\n" (List.map (String.concat "") r)
ext
is called on cases not defined in this module, it should compile extensions to one of these cases. The default raises Invalid_argument
.
id ?buf i
derives an identifier for inline i
using buf
as scratch space (one is created if unspecified).
This converts i
to plain text using Inline.to_plain_text
, then applies the same normalization performed on labels, maps spaces to character -
(U+002D), drops Unicode punctuation characters except -
(U+002D) and _
(U+005F
).
ext
is given to Inline.to_plain_text
.