Documentation ¶
Index ¶
- func Append(node, subelement *html.Node)
- func Element(tagName string) *html.Node
- func Extend(node *html.Node, subelements ...*html.Node)
- func FromString(str string) *html.Node
- func Iter(element *html.Node, tags ...string) []*html.Node
- func IterText(node *html.Node, separator string) string
- func Remove(element *html.Node, keepTail ...bool)
- func SetTail(element *html.Node, tail string)
- func SetText(element *html.Node, text string)
- func Strip(element *html.Node)
- func StripElements(tree *html.Node, keepTail bool, tags ...string)
- func StripTags(tree *html.Node, tags ...string)
- func SubElement(parent *html.Node, tagName string) *html.Node
- func Tail(element *html.Node) string
- func TailNodes(element *html.Node) []*html.Node
- func Text(element *html.Node) string
- func ToString(tree *html.Node, prettify ...bool) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromString ¶
FromString parses an HTML document or element from a string.
func Iter ¶
Iter loops over this element and all subelements in document order, and returns all elements with a matching tag.
func IterText ¶
IterText loops over this element and all subelements in document order, and returns all inner text. Similar with dom.TextContent, except here we add whitespaces when element level changed.
func Remove ¶
Remove will removes the element and its entire subtree, including all of its attributes, text content and descendants. It will also remove the tail text of the element unless you explicitly set the keepTail argument to true.
func Strip ¶
Strip will removes the element but not their text/tail content or descendants. Instead, it will merge the text content and children of the element into its parent.
func StripElements ¶
StripElements deletes all elements with the provided tag names from a tree or subtree. This will remove the elements and their entire subtree, including all their attributes, text content and descendants. It will also remove the tail text of the element unless you explicitly set the keepTail argument to true.
func StripTags ¶
StripTags deletes all elements with the provided tag names from a tree or subtree. This will remove the elements and their attributes, but not their text/tail content or descendants. Instead, it will merge the text content and children of the element into its parent.
func SubElement ¶
SubElement creates a html.Node with specified tag name, and append it to an existing element.
func Tail ¶
Tail returns text after this element's end tag, but before the next sibling element's start tag. If there was no text, this function will returns an empty string.
Types ¶
This section is empty.