feat: Add Node#TrimmedText

This commit is contained in:
ptrcnull 2022-07-08 00:32:27 +02:00
parent 5ab9ae9ca3
commit f84ae8d1fd

View file

@ -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)