A document that is not yet rendered. The argument is the type of tags in the document. For instance tags might be used for styles.
Basic combinators
val nop : _ tA pretty printer that prints nothing
concat ?sep l prints elements in l separated by sep. sep defaults to nop.
Convenience function for List.map followed by concat
val verbatim : string -> _ tAn indivisible block of text
val char : char -> _ tA single character
val text : string -> _ tPrint a bunch of text. The line may be broken at any spaces in the text.
val textf : ('a, unit, string, _ t) Stdlib.format4 -> 'aSame as text but take a format string as argument.
Break hints
val space : _ tEither a newline or a space, depending on whether the line is broken at this point.
val cut : _ tEither a newline or nothing, depending on whether the line is broken at this point.
val break : nspaces:int -> shift:int -> _ tEither a newline or nspaces spaces. If it is a newline, shift is added to the indentation level.
val newline : _ tForce a newline to be printed
Boxes
Try to put as much as possible on each line. Additionally, a break hint always break the line if the breaking would reduce the indentation level (break with negative shift value).
If possible, print everything on one line. Otherwise, behave as a vbox
Common convenience functions
enumerate l ~f produces an enumeration of the form:
- item1 - item2 - item3 ...
chain l ~f is used to print a succession of items that follow each other. It produces an output of this form:
item1 -> item2 -> item3 ...
Operators
module O : sig ... endRendering
val render : Stdlib.Format.formatter -> 'a t -> tag_handler:(Stdlib.Format.formatter -> 'a -> 'a t -> unit) -> unitRender a document to a classic formatter
val render_ignore_tags : Stdlib.Format.formatter -> 'a t -> unit