module Rich_text:sig
..end
type
message
val size : message -> int
val char_at : message -> int -> char
val string : message -> string
val substring : message -> int -> int -> string
message -> int -> (Transitioning.Format.stag * int * int) list
: val visit : ?output:(string -> int -> int -> unit) ->
?open_tag:(Transitioning.Format.stag -> int -> int -> unit) ->
?close_tag:(Transitioning.Format.stag -> int -> int -> unit) ->
message -> unit
val pretty : ?vbox:int -> Format.formatter -> message -> unit
Here, you have two different strategies to render the message properly.
If ~vbox
is specified, a vertical box is opened around the message,
and newlines are emitted with a "@\n"
and the given indentation.
Otherwise, no box is used and newlines are emitted as
"\n"
, which only makes sense if there is no current indentation in the
output formatter.
type
buffer
The buffer grows on demand, but is protected against huge mesages.
Maximal size is around 2 billions ASCII characters, which sould be enough
to store more than 25kloc source text.
val create : ?indent:int -> ?margin:int -> unit -> buffer
The right-margin is set to ~margin
and
maximum indentation to ~indent
.
Default values are those of Format.make_formatter
, which are
~indent:68
and ~margin:78
in OCaml 4.05.
val message : buffer -> message
val add_char : buffer -> char -> unit
val add_string : buffer -> string -> unit
val add_substring : buffer -> string -> int -> int -> unit
val formatter : buffer -> Format.formatter
val bprintf : buffer -> ('a, Format.formatter, unit) Pervasives.format -> 'a
val kprintf : (Format.formatter -> 'a) ->
buffer -> ('b, Format.formatter, unit, 'a) Pervasives.format4 -> 'b
val contents : buffer -> string
Buffer.contents
val sub : buffer -> int -> int -> string
Buffer.sub
val range : buffer -> int -> int -> string
range b p q
is sub b p (q+1-p)
val trim : buffer -> int * int
val shrink : buffer -> unit