Documentation
¶
Index ¶
- Variables
- func Data(value string, str string) *element
- func New(nodes ...node.Node) *element
- func RawText(str string) *element
- func RawTextf(format string, args ...any) *element
- func Static(str string) *element
- func Text(str string) *element
- func Textf(format string, args ...any) *element
- type Element
Constants ¶
This section is empty.
Variables ¶
var ( TagOpen = []byte("<data") TagClose = []byte("</data>") AttrValue = []byte(" value=\"") )
Byte constants for HTML rendering.
Functions ¶
func Data ¶
Data Creates a new data element with a machine-readable value and human-readable text content Example: data.Data("398", "Mini Ketchup") Renders: <data value="398">Mini Ketchup</data>
func New ¶
New Creates a new data element with the given child nodes. Example: data.New(text.Text("Mini Ketchup")) Renders: <data>Mini Ketchup</data>
func RawText ¶
func RawText(str string) *element
RawText Creates a new data element with raw text content as unescaped HTML. Example: data.RawText("<b>Mini Ketchup</b>") Renders: <data><b>Mini Ketchup</b></data>
func RawTextf ¶
RawTextf Creates a new data element with formatted raw text content as unescaped HTML using text.RawTextf. Example: data.RawTextf("Hello <em>%s</em>", "World") Renders: <data>Hello <em>World</em></data>
func Static ¶
func Static(str string) *element
Static Creates a new data element with static text content. Example: data.Static("Hello World") Renders: <data>Hello World</data>