Awesome Go

htree

CategoryText Processing
SubcategoryMarkup Languages
Stars0

Traverse, navigate, filter, and otherwise process trees of [html.Node](https://pkg.go.dev/golang.org/x/net/html#Node) objects

About htree

Htree - Go package for working with html.Node trees

Go Reference Go Report Card Tests Coverage Status Mentioned in Awesome Go

This is htree, a Go package that helps traverse, navigate, filter, and otherwise process trees of html.Node objects.

Usage

root, err := html.Parse(input)
if err != nil { ... }

body := htree.FindEl(root, func(n *html.Node) bool {
  return n.DataAtom == atom.Body
})

content := htree.FindEl(body, func(n *html.Node) bool {
  return n.DataAtom == atom.Div && htree.ElClassContains(n, "content")
})

...etc...

Frequently Asked Questions

What is htree?

htree is a Text Processing library for the Go programming language. Traverse, navigate, filter, and otherwise process trees of [html.Node](https://pkg.go.dev/golang.org/x/net/html#Node) objects

How do I install htree?

Install htree with the Go module system using `go get bobg/htree`. Check the repository for the current installation instructions.

What category does htree belong to?

htree is listed under Text Processing, specifically Markup Languages.

← Back to Markup Languages