Module Cmarkit.Link_definition

Link definitions.


type layout = {
  1. indent : Layout.indent;

    Amount of indentation, 0 on inline links.

  2. angled_dest : bool;

    true if destination is between <…>.

  3. before_dest : Block_line.blank list;

    Blanks to destination.

  4. after_dest : Block_line.blank list;

    Blanks after destination.

  5. title_open_delim : Layout.char;

    Title open delimiter ('\"', '(', …)

  6. after_title : Block_line.blank list;

    Blanks after title (inline links).


The type for link reference layout.

val layout_for_dest : string -> layout

layout_for_dest d computes a layout value for destination d. This just determines if angled_dest needs to be true.

type t

The type for representing link references definitions and inline links.

val make : ?layout:layout -> ?defined_label:Label.t option -> ?label:Label.t -> ?dest:string node -> ?title:Block_line.tight list -> unit -> t

make () is a link reference with given parameters. If dest is given and layout is not, the latter is computed with layout_for_dest. label is a label if the link is defined via a link reference definition. defined_label defaults to label.

val layout : t -> layout

layout ld is the layout of ld.

val label : t -> Label.t option

label ld is None if this is a link definition for an inline link. It is Some l, if ld is a link reference definition. l is the label as found in the text. The result of the resolver is in defined_label.

val defined_label : t -> Label.t option

defined_label ld is the label determined by the Label.resolver for the link definition reference. The label as found in the source text is in label. If this is None either it's a link definition for an inline link or the resolver deleted the label definition.

val dest : t -> string node option

dest ld is the link destination of ld. None means there was no destination. CommonMark renders that as an empty href in HTML.

val title : t -> Block_line.tight list option

title ld is the title of the reference, if any.

As label definitions

type Label.def +=
  1. | Def of t node

A label definition for links.