Module Block.Code_block

Code blocks.

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

    Indent to opening fence

    *)
  2. opening_fence : Layout.string node;
    (*

    Opening fence (before info string).

    *)
  3. closing_fence : Layout.string node option;
    (*

    Closing fence (if any).

    *)
}

The type for fenced code block layouts.

type layout = [
  1. | `Indented
  2. | `Fenced of fenced_layout
]

The type for code block layouts.

type t

The type for indented and fenced code blocks.

val make : ?layout:layout -> ?info_string:string node -> Block_line.t list -> t

make ?layout ?info_string code is a code block with given parameters. layout defaults to a fenced layout. If layout is `Indented and an info_string is provided, the layout is switched to `Fenced.

val layout : t -> layout

layout cb is the layout of cb.

val info_string : t -> string node option

info_string cb is the info string of cb, if any.

val code : t -> Block_line.t list

code cb are the code lines of cb.

val make_fence : t -> Layout.char * Layout.count

make_fence cb is a fence character and count suitable for cb.

val language_of_info_string : string -> (string * string) option

language_of_info_string s extracts a (non-empty) language, the first word of s and a trimmed remainder. Assumes s is String.trimed which is what info_string gives you.