Documentation
¶
Index ¶
- type Document
- type NavigableString
- type Node
- type Predicate
- func All(predicates ...Predicate) Predicate
- func Any(predicates ...Predicate) Predicate
- func AttrContains(attr string, substr string) Predicate
- func AttrEq(attr string, value string) Predicate
- func AttrMatch(attr string, pattern *regexp.Regexp) Predicate
- func HasAttr(attr string) Predicate
- func HasClass(class string) Predicate
- func HasName(name string) Predicate
- func HasNoAttr(attr string) Predicate
- func HasNoClass() Predicate
- type Tag
- func (tag *Tag) Children() []*Tag
- func (tag *Tag) ChildrenCount() int
- func (tag *Tag) Depth() int
- func (tag *Tag) Find(predicate Predicate) *Tag
- func (tag *Tag) FindAll(predicate Predicate) []*Tag
- func (tag *Tag) FindParent(predicate Predicate) *Tag
- func (tag *Tag) FirstChild() *Tag
- func (tag *Tag) FullText(sep ...string) string
- func (tag *Tag) IterNodes() iter.Seq[Node]
- func (tag *Tag) Next() *Tag
- func (tag *Tag) Parent() *Tag
- func (tag *Tag) Prev() *Tag
- func (tag *Tag) String() string
- func (tag *Tag) Text() string
- func (tag *Tag) Unwrap()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Document ¶ added in v1.2.0
type Document struct {
// contains filtered or unexported fields
}
Corresponds to HTML document
func Parse ¶
Parse HTML document from given reader and return root tag. Since Parse() from the golang.org/x/net/html library is used internally, the rules for basic Parse also apply for this function:
* "Parse will reject HTML that is nested deeper than 512 elements."
* "The input is assumed to be UTF-8 encoded."
func ParseBytes ¶
Parse given HTML document bytes and return root tag. Since Parse() from the golang.org/x/net/html library is used internally, the rules for basic Parse also apply for this function:
* "Parse will reject HTML that is nested deeper than 512 elements."
* "The input is assumed to be UTF-8 encoded."
func ParseString ¶
Parse given HTML document string and return root tag. Since Parse() from the golang.org/x/net/html library is used internally, the rules for basic Parse also apply for this function:
* "Parse will reject HTML that is nested deeper than 512 elements."
* "The input is assumed to be UTF-8 encoded."
type NavigableString ¶ added in v1.1.0
type NavigableString struct {
}
Raw string node in HTML document
type Node ¶ added in v1.1.0
type Node interface {
// contains filtered or unexported methods
}
Corresponds to HTML node in the document (tag, raw string, etc.)
type Tag ¶
Corresponds to HTML tag in the document
func (*Tag) ChildrenCount ¶ added in v1.2.1
Returns count of all inner tags
func (*Tag) FindParent ¶
Find parent tag by predicate
func (*Tag) IterNodes ¶ added in v1.1.0
Iterate through all children nodes of current tag, including raw strings