html

package
v0.144.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 22, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindAllHTMLNodes

func FindAllHTMLNodes(n *html.Node, tag string) []*html.Node

FindAllHTMLNodes returns all nodes matching the tag within n.

func FindHTMLNode

func FindHTMLNode(n *html.Node, tag string) *html.Node

FindHTMLNode does a depth-first search for the first node matching the tag.

func FindMainImage

func FindMainImage(page []byte, rawURL string) (string, error)

FindMainImage tries to find a "main" image for the page, using the readability parser.

func IsHTML

func IsHTML(s string) bool

func IsHTMLElement

func IsHTMLElement(str, tag string) bool

IsHTMLElement returns a boolean indicating whether the given string is the given HTML element.

func SanitizeHTMLString added in v0.83.0

func SanitizeHTMLString(rawStr string) (string, error)

SanitizeHTMLString will parse and re-render the given string containing HTML. In doing so, the HTML is hopefully sanitized and reformatted to be well-formed HTML.

Types

type Favicon

type Favicon struct {
	// contains filtered or unexported fields
}

Favicon is a favicon link found in <head>.

func FindFavicon

func FindFavicon(
	page []byte,
	pageURL string,
) ([]byte, string, Favicon, error)

FindFavicon tries each candidate in order and returns the first one that responds with a 2xx status and a non-empty body.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL