Reference
ANSIColoredPrinters.PlainTextPrinter
— TypePlainTextPrinter(buf::IO; keep_invert=true)
Creates a printer for MIME"text/plain"
output.
Arguments
buf
: A sourceIO
object containing a text with ANSI escape codes.keep_invert
: If true, "invert" (SGR code 7) is printed as is.
If keep_invert
is false
, the color change codes with "invert" enable are reinterpreted as explicit foreground and background color specifications. In this case, the normal inverted foreground color is considered black (SGR code
- and the normal inverted background color is considered white (SGR code 47).
ANSIColoredPrinters.HTMLPrinter
— TypeHTMLPrinter(buf::IO; keep_invert=false, root_class="", root_tag="pre", callback=nothing)
Creates a printer for MIME"text/html"
output.
Arguments
buf
: A sourceIO
object containing a text with ANSI escape codes.keep_invert
: Iftrue
, "invert" (SGR code 7) is marked up asclass="sgr7"
.root_class
: Theclass
attribute value for the root element.root_tag
: The tag name for the root element.callback
: A callback method (see below).
If keep_invert
is false
(default), the color change codes with "invert" enable are reinterpreted as explicit foreground and background color specifications. In this case, the normal inverted foreground color is marked up as class="sgr-39"
and the normal inverted background color is marked up as class="sgr-49"
.
Callback method
callback(io::IO, printer::HTMLPrinter, tag::String, attrs::Dict{Symbol, String})
The callback
method will be called just before writing HTML tags.
Callback arguments
io
: The destinationIO
object.printer
: TheHTMLPrinter
in use.tag
: The HTML tag to be written. For closing tags, they have the prefix "/".attrs
: A dictionary consisting of pairs of aSymbol
for the attributes (e.g.:class
,:style
) and theString
for its value.
Callback return value
If the return value is nothing
, the printer writes the HTML tag to the io
according to the tag
and the attrs
after the call. If the return value is not nothing
, this default writing will be prevented.