feat: Add Node#TrimmedText
This commit is contained in:
parent
5ab9ae9ca3
commit
f84ae8d1fd
1 changed files with 4 additions and 0 deletions
4
html.go
4
html.go
|
@ -185,6 +185,10 @@ func (n *Node) Text() string {
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (n *Node) TrimmedText() string {
|
||||||
|
return strings.Trim(n.Text(), " \n\t")
|
||||||
|
}
|
||||||
|
|
||||||
func (n *Node) Render() (string, error) {
|
func (n *Node) Render() (string, error) {
|
||||||
w := bytes.NewBuffer([]byte{})
|
w := bytes.NewBuffer([]byte{})
|
||||||
err := html.Render(w, n.Node)
|
err := html.Render(w, n.Node)
|
||||||
|
|
Loading…
Reference in a new issue