Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attributes ¶
type Attributes []Attribute
Attributes is a slice of Attribute.
func (Attributes) ByKey ¶
func (a Attributes) ByKey(key string) Attribute
ByKey finds an Attribute by its key. Returns a zero value if not found.
type Formatter ¶
type Formatter struct {
// contains filtered or unexported fields
}
Formatter configures the formatting and can be safely reused.
type Option ¶
type Option func(f *Formatter)
Option sets an option of the HTML formatter.
func WithNewlineAttributePlaceholder ¶
WithNewlineAttributePlaceholder is admittedly a specialist option.
It was added for the gotfmt Go template preprocessor which needed to preserve some newlines around certain template blocks. Setting this to "newline" and the formatter will only print the whitespace produced by "<br newline/>".
Note that this is only supported for void/self closing elements.
func WithTextFormatters ¶
func WithTextFormatters(lookup func(tag Tag) TextFormatter) Option
WithTextFormatters configures the formatter to use the provided lookup func to find a formatter for a block of text inside tag (e.g. a JavaScript formatter).
type TextFormatter ¶
TextFormatter allows clients to plug in a text formatter for a given tag, e.g. <script> blocks.