HTMLOutputStyle

Determines how the generated HTML gets styled.

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.

Values

ValueMeaning
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

Examples

1 @dietTraits
2 struct Traits {
3 	enum htmlOutputStyle = HTMLOutputStyle.pretty;
4 }
5 
6 import std.array : appender;
7 auto dst = appender!string();
8 dst.compileHTMLDietString!("html\n\tbody\n\t\tp Hello", Traits);
9 import std.conv : to;
10 assert(dst.data == "<html>\n\t<body>\n\t\t<p>Hello</p>\n\t</body>\n</html>", [dst.data].to!string);

Meta