Module Block.Heading

Headings.

type atx_layout = {
  1. indent : Layout.indent;
    (*

    Indent to '#'.

    *)
  2. after_opening : Layout.blanks;
    (*

    Blanks after '#'.

    *)
  3. closing : Layout.string;
    (*

    Closing sequence of '#' and blanks.

    *)
}

The type for ATX heading layout.

type setext_layout = {
  1. leading_indent : Layout.indent;
    (*

    Of heading first line.

    *)
  2. trailing_blanks : Layout.blanks;
    (*

    Of heading last line.

    *)
  3. underline_indent : Layout.indent;
    (*

    Indentation of underline.

    *)
  4. underline_count : Layout.count node;
    (*

    Underline char count.

    *)
  5. underline_blanks : Layout.blanks;
    (*

    Underline trailing blanks.

    *)
}

The type for setext heading layout.

type layout = [
  1. | `Atx of atx_layout
  2. | `Setext of setext_layout
]

The type for heading layouts.

type id = [
  1. | `Auto of string
    (*

    Automatically derived.

    *)
  2. | `Id of string
    (*

    Explicitely specified in another way.

    *)
]

The type for heading identifiers. This notion does not exist in CommonMark.

type t

The type for ATX and Setext headings.

val make : ?id:id -> ?layout:layout -> level:int -> Inline.t -> t

make ~level text is a heading with given parameters. layout defaults to `Atx so you should make sure text has no breaks. level is clamped to 1-6 or 1-2 depending on layout. id is an identifier for the heading.

val layout : t -> layout

layout h is the layout of h.

val level : t -> int

level h is the level of h, from 1 to 6.

val inline : t -> Inline.t

inline h is the contents of the heading.

val id : t -> id option

id h is the heading identifier (if any). Can be automatically derived at parse time from the heading inline if heading_auto_ids:true. Can also be derived later via Inline.id.