package containers

  1. Overview
  2. Docs

Extension node.

Custom nodes can be used to add user-defined behavior to the rendered output. For example, documents might be annotated with ANSI-terminal colors, or with HTML tags.

type 'a t = {
  1. pre : Out.t -> 'a -> unit;

    Printed before the wrapped value.

  2. post : Out.t -> 'a -> unit;

    Printed after the wrapped value.


An extension is a custom document node. It takes a value of type 'a, and a document d, and can output what it wants based on the custom value before and after d is printed.

The extension is considered to have width 0.