package dune
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=77cb5f483221b266ded2b85fc84173ae0089a25134a086be922e82c131456ce6
sha512=02f00fd872aa49b832fc8c1e928409f23c79ddf84a53009a58875f222cca36fbb92c905e12c539caec9cbad723f195a8aa24218382dca35a903b3f52b11f06f2
doc/dune._stdune/Stdune/Pp/index.html
Module Stdune.Pp
Pretty printers
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 : _ t
A 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 -> _ t
An indivisible block of text
val char : char -> _ t
A single character
val text : string -> _ t
Print a bunch of text. The line may be broken at any spaces in the text.
Break hints
val space : _ t
Either a newline or a space, depending on whether the line is broken at this point.
val cut : _ t
Either a newline or nothing, depending on whether the line is broken at this point.
val break : nspaces:int -> shift:int -> _ t
Either a newline or nspaces
spaces. If it is a newline, shift
is added to the indentation level.
val newline : _ t
Force a newline to be printed
Boxes
Boxes are the basic components to control the layout of the text. Break hints such as space
and cut
may cause the line to be broken, depending on the splitting rules. Whenever a line is split, the rest of the material printed in the box is indented with indent
.
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 ... end
Rendering
val render :
Format.formatter ->
'a t ->
tag_handler:(Format.formatter -> 'a -> 'a t -> unit) ->
unit
Render a document to a classic formatter
val render_ignore_tags : Format.formatter -> 'a t -> unit