Documentation
¶
Overview ¶
Package variable provides constructors and methods for the HTML <var> element.
The <var> HTML element represents the name of a variable in a mathematical expression or a programming context.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( TagOpen = []byte("<var") TagClose = []byte("</var>") )
Byte constants for HTML rendering.
Functions ¶
func New ¶
New creates a new var element with optional child nodes. Example: variable.New() Renders: <var></var>
func RawText ¶
func RawText(content string) *element
RawText creates a new var element with raw text content. Uses text.RawText which is not HTML-escaped. Example: variable.RawText("<sub>i</sub>") Renders: <var><sub>i</sub></var>
func RawTextf ¶
RawTextf creates a new var element with formatted raw text content. Uses text.RawTextf which is not HTML-escaped. Example: variable.RawTextf("%s<sub>%d</sub>", varName, index) Renders: <var>x<sub>1</sub></var>
func Static ¶
func Static(content string) *element
Static creates a new var element with static text content. Uses text.Static which is not HTML-escaped and is JIT-optimisable. Example: variable.Static("n") Renders: <var>n</var>