Documentation
¶
Overview ¶
Package sub provides constructors and methods for the HTML <sub> element.
The <sub> HTML element specifies inline text which should be displayed as subscript for solely typographical reasons. Subscripts are typically rendered with a lowered baseline using smaller text.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( TagOpen = []byte("<sub") TagClose = []byte("</sub>") )
Byte constants for HTML rendering.
Functions ¶
func New ¶
New creates a new sub element with the given child nodes. Example: sub.New(text.Text("2")) Renders: <sub>2</sub>
func RawText ¶
func RawText(content string) *element
RawText creates a new sub element with raw text content. Uses text.RawText which is not HTML-escaped. Example: sub.RawText("<var>i</var>") Renders: <sub><var>i</var></sub>
func RawTextf ¶
RawTextf creates a new sub element with formatted raw text content. Uses text.RawTextf which is not HTML-escaped. Example: sub.RawTextf("<var>%s</var>", varName) Renders: <sub><var>x</var></sub>
func Static ¶
func Static(content string) *element
Static creates a new sub element with static text content. Uses text.Static which is not HTML-escaped and is JIT-optimisable. Example: sub.Static("n") Renders: <sub>n</sub>