package cmarkit
-
cmarkit
Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
Links.
type inline := t
type reference = [
| `Inline of Link_definition.t node
| `Ref of reference_layout * Label.t * Label.t
Reference links. First label is the label of the reference, second label is the label of the referenced definition.
*) ]
The type for references.
make i ref
is a link for text i
and link reference ref
.
If you plan to render to CommonMark and this is not an inline reference you should include a Block.Link_reference_definition
(or Block.Ext_footnote_definition
) for ref
somewhere in the document, otherwise the reference will not parse back.
referenced_label l
is the label referenced by the label of l
. This is the second label of `Ref _
or None
on inline references.
val reference_definition : Label.defs -> t -> Label.def option
reference_definition defs l
is the definition of l
's reference. If l
is an `Inline
reference this returns its link definition wrapped in a Link_definition.Def
. If l
is `Ref
this looks up the referenced_label
in defs
.
is_unsafe url
is true
if url
is deemed unsafe. This is the case if url
starts with a caseless match of javascript:
, vbscript:
, file:
or data:
except if data:image/{gif,png,jpeg,webp}
. These rules were taken from cmark
, the C reference implementation of CommonMark and are likely incomplete. If you are trying to prevent XSS you should post-process rendering outputs with a dedicated HTML sanitizer.