Documentation
¶
Index ¶
- func AttributeMap(node *html.Node) map[string]string
- func Body(node *html.Node) *html.Node
- func Children(node *html.Node) []*html.Node
- func ChildrenFunc(node *html.Node, predicate func(*html.Node) bool) []*html.Node
- func ElementsByTagName(node *html.Node, tags ...string) []*html.Node
- func Head(node *html.Node) *html.Node
- func HeadingLevel(node *html.Node) (int, error)
- func HeadingMap() map[string]int
- func Headings(node *html.Node) []*html.Node
- func Html(nodes ...*html.Node) (template.HTML, error)
- func IsBody(node *html.Node) bool
- func IsElement(node *html.Node) bool
- func IsElementFunc(node *html.Node, predicate func(*html.Node) bool) bool
- func IsHead(node *html.Node) bool
- func IsHeading(node *html.Node) bool
- func IsNil(node *html.Node) bool
- func IsText(node *html.Node) bool
- func New(string string) (*html.Node, error)
- func SiblingsUntilFunc(node *html.Node, predicate func(*html.Node) bool) []*html.Node
- func TagName(node *html.Node) string
- func Text(node *html.Node) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AttributeMap ¶
AttributeMap returns a map of attribute key-value pairs for a given HTML node. If the HTML node is nil or the HTML node contains no attributes, an empty map is returned.
func Body ¶
Body returns the first occurrence of a HTML "body" element in the subtree of the given HTML node, or nil if not found.
func Children ¶
Children returns a slice of child HTML nodes of the provided HTML node that are either an element or a text node. If none of the child HTML nodes satisfies this condition, an empty slice is returned.
func ChildrenFunc ¶
ChildrenFunc returns a slice of child HTML nodes of the given HTML node that satisfy the given predicate. The predicate function is used to filter child HTML nodes based on the provided condition. The returned slice contains all child HTML nodes that satisfy the predicate, in the order they appear in the HTML node.
func ElementsByTagName ¶
ElementsByTagName recursively returns a slice of HTML nodes with the given HTML tag name(s). If the provided HTML node is nil or if no tags are provided, an empty slice is returned.
func Head ¶
Head returns the first occurrence of a HTML "head" element in the subtree of the given HTML node, or nil if not found.
func HeadingLevel ¶
HeadingLevel returns the HTML heading level (numeric value of "h" tag) for a given HTML heading node. If the given HTML node does not contain a valid HTML heading tag (h1, h2, ..., h6), it returns -1 and an error.
func HeadingMap ¶
HeadingMap returns a map of HTML heading tags (h1, h2, ..., h6) as keys and their corresponding HTML heading levels (1, 2, ..., 6) as values.
func Headings ¶
Headings returns a slice of HTML nodes representing the HTML heading elements (h1 to h6) that are direct children of the given HTML node.
func IsElementFunc ¶
IsElementFunc checks if the given HTML node represents an HTML element node and satisfies a custom predicate function.
func SiblingsUntilFunc ¶
SiblingsUntilFunc returns a slice of HTML nodes representing the siblings of the given HTML node, until a HTML sibling node that satisfies the provided predicate function is encountered. If the predicate function is nil or if no HTML node satisfies the condition in the predicate function, all siblings of the given HTML node are returned.
Types ¶
This section is empty.