Format_doc.Doc
Definitions and immutable API for composing documents
type stag = Stdlib.Format.stag
type element =
| Text of string
| With_size of int
| Open_box of {
kind : box_type;
indent : int;
}
| Close_box
| Open_tag of Stdlib.Format.stag
| Close_tag
| Open_tbox
| Tab_break of {
}
| Set_tab
| Close_tbox
| Simple_break of {
}
| Break of {
}
| Flush of {
}
| Newline
| If_newline
| Deprecated of Stdlib.Format.formatter -> unit
Escape hatch: a Format
printer used to provide backward-compatibility for user-defined printer (from the #install_printer
toplevel directive for instance).
Base formatting instruction recognized by Format
type 'a printer = 'a -> printer0
val empty : t
Empty document
val format : Stdlib.Format.formatter -> t -> unit
format ppf doc
sends the format instruction of doc
to the Format's formatter doc
.
Fold over a document as a sequence of instructions
The functions below mirror Format
printers, without the pp_print_
prefix naming convention
val close_box : printer0
val text : string printer
val string : string printer
val bytes : bytes printer
val with_size : int printer
val int : int printer
val float : float printer
val char : char printer
val bool : bool printer
val space : printer0
val cut : printer0
val break : spaces:int -> indent:int -> printer0
val custom_break : fits:(string * int * string) as 'a -> breaks:'a -> printer0
val force_newline : printer0
val if_newline : printer0
val flush : printer0
val force_stop : printer0
val open_tbox : printer0
val set_tab : printer0
val tab : printer0
val tab_break : width:int -> offset:int -> printer0
val close_tbox : printer0
val close_tag : printer0
val seq : ?sep:printer0 -> 'a printer -> 'a Stdlib.Seq.t printer
val either :
left:'a printer ->
right:'b printer ->
('a, 'b) Stdlib.Either.t printer