package yocaml

  1. Overview
  2. Docs

Generic table of contents representation.

type 'a t

Type describing an entry tree in a table of contents. The representation of the elements is left to the implementation of plugins.

val from_list : (int * 'a) list -> 'a t

Builds a table of contents from an indexed list. For example, a list of headings in a Markdown document.

val to_labelled_list : 'a t -> (int list * 'a) list

to_labelled_list toc converts toc into a list of labelled nodes. Each node is paired with an index represented as a list of integers, which indicates the node’s position in the hierarchical tree structure.

val to_html : ?ol:bool -> ('a -> string) -> (string * 'a) t -> string option

to_html ?ol label_to_string toc_of_id_and_label from a table of contents build on top of a list of id * label, generate the corresponding HTML.

OCaml

Innovation. Community. Security.