Documentation
¶
Index ¶
- Variables
- type Element
- func A() *Element
- func B() *Element
- func Background() *Element
- func Body() *Element
- func Br() *Element
- func Div() *Element
- func Em() *Element
- func Form() *Element
- func H1() *Element
- func H2() *Element
- func Head() *Element
- func I() *Element
- func Img() *Element
- func Input() *Element
- func Label() *Element
- func Li() *Element
- func Meta() *Element
- func NewElement(tag string) *Element
- func NewHTML() *Element
- func P() *Element
- func Span() *Element
- func Style() *Element
- func Svg() *Element
- func Table() *Element
- func Tbody() *Element
- func Thead() *Element
- func Title() *Element
- func Tr(element ...*TableCell) *Element
- func Ul() *Element
- func (e *Element) AppendChild(child ...*Element) *Element
- func (e *Element) AppendContent(v ...any) *Element
- func (e *Element) AppendHTML(html ...string) *Element
- func (e *Element) Attribute(name, value string) *Element
- func (e *Element) Class(class ...string) *Element
- func (e *Element) Clone() *Element
- func (e *Element) Content(v ...any) *Element
- func (e *Element) Contentf(format string, a ...any) *Element
- func (e *Element) HTML() HTML
- func (e *Element) HTMLContent(html string) *Element
- func (e *Element) Href(href string) *Element
- func (e *Element) Name(name string) *Element
- func (e *Element) Src(src string) *Element
- func (e *Element) String() string
- func (e *Element) Style(style string) *Element
- func (e *Element) Title(title string) *Element
- type HTML
- type HTMLer
- type TableCell
- func (cell *TableCell) Abbr(abbr string) *TableCell
- func (cell *TableCell) Class(class ...string) *TableCell
- func (cell *TableCell) Colspan(n uint) *TableCell
- func (cell *TableCell) Headers(headers string) *TableCell
- func (cell *TableCell) Rowspan(n uint) *TableCell
- func (cell *TableCell) Scope(scope string) *TableCell
- func (cell *TableCell) Style(style string) *TableCell
Constants ¶
This section is empty.
Variables ¶
var ( // EscapeString is alias of [html.EscapeString], // used for encoding HTML entities. EscapeString = html.EscapeString // UnescapeString is alias of [html.UnescapeString], // used for decoding HTML entities. UnescapeString = html.UnescapeString )
Functions ¶
This section is empty.
Types ¶
type Element ¶
type Element struct {
// contains filtered or unexported fields
}
Element represents a single HTML element, including its tag name, attributes, and inner HTML content.
func Background ¶
func Background() *Element
Background creates an element with no tag, typically used for raw content.
func NewElement ¶
NewElement creates and returns a new HTML element with the given tag name.
func (*Element) AppendChild ¶
AppendChild appends child elements to the current element.
func (*Element) AppendContent ¶
AppendContent appends additional content to the element.
func (*Element) AppendHTML ¶
AppendHTML appends one or more raw HTML strings directly to the element.
func (*Element) Attribute ¶
Attribute sets or updates an attribute on the element. If attrs is nil, it initializes the map.
func (*Element) Clone ¶ added in v0.1.81
Clone creates a deep copy of the element and its attributes.
func (*Element) Contentf ¶
Contentf formats a string using fmt.Sprintf and sets it as the element content.
func (*Element) HTMLContent ¶
HTMLContent inserts raw (unescaped) HTML into the element content.
type HTMLer ¶
type HTMLer interface {
HTML() HTML
}
HTMLer defines types that can render themselves as HTML.
type TableCell ¶
type TableCell struct{ *Element }
TableCell wraps an Element and provides methods specific to <td> and <th> cells.
func (*TableCell) Colspan ¶
Colspan sets the "colspan" attribute, specifying how many columns the cell spans.
func (*TableCell) Rowspan ¶
Rowspan sets the "rowspan" attribute, specifying how many rows the cell spans.