package cmarkit

  1. Overview
  2. Docs
CommonMark parser and renderer for OCaml

Install

Dune Dependency

Authors

Maintainers

Sources

cmarkit-0.3.0.tbz
sha512=42fa920e84f2b7d45f5cf1251d3308daa7becff2590f7ce84186cb22335415b02cc9bc44179095bf0d37624fb5a0e66d1c96fcc1b12f1106f567247a71c79039

doc/cmarkit/Cmarkit/Block/Code_block/index.html

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.

OCaml

Innovation. Community. Security.