Module Vz_doc.Doc

Document.

Documents are built by sequences of toplevel definition which are eventually rendered by a Doc.render.

val input : ('a * Input.t) -> 'a

input (_, i) appends input i at that point. It is recommended to apply this as a posfix via the ( |> ) operator. For example:

let checkme = Input.bool ~init:false (`Txt "Check me!") |> Doc.input
val output : Output.t -> unit

output o appends output o at that point. It is recommended to apply this as postfix operator via the ( |> ) operator. For example:

let () = Output.image image |> Doc.output
val md : string -> unit

md s appends s as CommonMark text. This is meant to be used directly as a toplevel expression as follows:

;; Doc.md {|
   … Write *CommonMark* here.
|}
val el : Brr.El.t -> unit

el appends el.

val txt' : string Note.signal -> unit

txt' appends a reactive paragraph.

val txt : ('a, Stdlib.Format.formatter, unit, unit) Stdlib.format4 -> 'a

txt appends a paragraph.

val css : string -> unit

css css appends css css in a style element.

Rendering

val render : ?css:bool -> ?root:Brr.El.t -> unit -> unit

render ?root ?css () renders the document definition:

  • root is the element to which the definitions are appended to. Defaults to the Brr.Document.body of Brr.G.document.
  • If css is true (default) the default css is added as the first child.

Note that this flushes the document buffer, a new document can be rendered aftewards.