A struct that accepts an element block ~ (html) { } and writes the content to a string.
The resulting content will be wrapped in an Element, making it compatible with the old elemi API. Note that metadata is not preserved, so adding attributes or child nodes from Element will not be possible.
If no arguments are specified, buildHTML() will output to a string. Under the hood, it uses an std.array.Appender.
import std.array; string stringOutput = buildHTML() ~ (html) { html.p ~ "Hello!"; }; Appender!string rangeOutput; buildHTML(rangeOutput) ~ (html) { html.p ~ "Hello!"; }; assert(stringOutput == rangeOutput[]);
HTML, the stream structure used to output data.
Write HTML elements to a string or Element.