Module Cmarkit.Block_line

Block lines.

In CommonMark blocks, a "line" does not necessarily correspond to a line in the source plain text. For example the lines of a paragraph in a block quote are the lines stripped from the block quote markers. We call the line resulting from stripping the block structure preceeding a given block a block line.

Lines

type t = string node

The type for block lines.

val to_string : t -> string

to_string l is (fst l).

val list_textloc : t list -> Textloc.t

list_textloc ls is a text location spanning the lines ls This is Textloc.none on [].

val list_of_string : ?meta:Meta.t -> string -> t list

list_of_string s cuts s on newlines. meta is used for all nodes, default to Meta.none.

Tight lines

type tight = Layout.blanks * t

The type for tight block lines. A block line with its initial blanks trimmed but kept for layout.

val tight_to_string : tight -> string

tight_to_string l is (fst (snd l)).

val tight_list_textloc : tight list -> Textloc.t

tigh_list_textloc ls is a text location spanning the lines ls This is Textloc.none on [].

val tight_list_of_string : ?meta:Meta.t -> string -> tight list

list_of_string s cuts s on newlines and computes the blanks (except on the first line where they are part of the data). meta is used for all nodes, default to Meta.none.

Blank lines

type blank = Layout.blanks node

The type for blank block lines.