Documentation
¶
Index ¶
- Variables
- func DateTime(datetime string, content string) *element
- func New(nodes ...node.Node) *element
- func RawText(content string) *element
- func RawTextf(format string, args ...any) *element
- func Static(content string) *element
- func Text(content string) *element
- func Textf(format string, args ...any) *element
- type Element
Constants ¶
This section is empty.
Variables ¶
var ( TagOpen = []byte("<time") TagClose = []byte("</time>") AttrDateTime = []byte(" datetime=\"") )
Byte constants for HTML rendering.
Functions ¶
func DateTime ¶
DateTime Creates a time element with a machine-readable datetime and human-readable display text. Uses text.Text which HTML-escapes the output. Example: time.DateTime("2023-12-25", "Christmas Day") Renders: <time datetime="2023-12-25">Christmas Day</time>
func New ¶
New Creates a new time element with optional child nodes Example: time.New() Renders: <time></time>
func RawText ¶
func RawText(content string) *element
RawText Creates a new time element with raw text content. Uses text.RawText which is not HTML-escaped. Example: time.RawText("<abbr>Dec</abbr> 25") Renders: <time><abbr>Dec</abbr> 25</time>
func RawTextf ¶
RawTextf Creates a new time element with formatted raw text content. Uses text.RawTextf which is not HTML-escaped. Example: time.RawTextf("<abbr>%s</abbr> %d", monthAbbr, day) Renders: <time><abbr>Jan</abbr> 15</time>
func Static ¶
func Static(content string) *element
Static Creates a new time element with static text content. Uses text.Static which is not HTML-escaped and is JIT-optimisable. Example: time.Static("Today") Renders: <time>Today</time>