Enum HTMLOutputStyle
Determines how the generated HTML gets styled.
enum HTMLOutputStyle
: int { ... }
To use this, put an enum field named htmlOutputStyle
into a diet traits
struct and pass that to the render function.
The default output style is compact
.
Enum members
Name | Description |
---|---|
compact
|
Outputs no extraneous whitespace (including line breaks) around HTML tags |
pretty
|
Inserts line breaks and indents lines according to their nesting level in the HTML structure |
Example
@dietTraits
struct Traits {
enum htmlOutputStyle = HTMLOutputStyle .pretty;
}
import std .array : appender;
auto dst = appender!string();
dst .compileHTMLDietString!("html\n\tbody\n\t\tp Hello", Traits);
import std .conv : to;
assert(dst .data == "<html>\n\t<body>\n\t\t<p>Hello</p>\n\t</body>\n</html>", [dst .data] .to!string);