xhtml

package
v0.0.0-...-d27b5d5 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package xhtml makes x/net/html easier

Index

Constants

View Source
const (
	Done     = false
	Continue = true
)

Variables

View Source
var MarkdownBlockElements = map[atom.Atom]bool{
	atom.P:  true,
	atom.H1: true,
	atom.H2: true,
	atom.H3: true,
	atom.H4: true,
	atom.H5: true,
	atom.H6: true,
	atom.Ul: true,
	atom.Ol: true,
}

Functions

func AdoptChildren

func AdoptChildren(dst, src *html.Node)

func AppendText

func AppendText(n *html.Node, text string)

func BreadFirst

func BreadFirst(n *html.Node, yield func(*html.Node) bool) bool

func Closest

func Closest(n *html.Node, cond func(*html.Node) bool) *html.Node

func ContentsToString

func ContentsToString(n *html.Node) string

func Find

func Find(n *html.Node, callback func(*html.Node) *html.Node) *html.Node

func FindAll

func FindAll(root *html.Node, filter func(*html.Node) bool) []*html.Node

func InnerText

func InnerText(n *html.Node) string

func IsEmpty

func IsEmpty(n *html.Node) bool

func LastChildOrNew

func LastChildOrNew(p *html.Node, tag string, attrs ...string) *html.Node

func Map

func Map[T any](tbl TableNodes, f func(*html.Node) T) [][]T

func New

func New(tag string, attrs ...string) *html.Node

func Tables

func Tables(root *html.Node, f func(tbl *html.Node, rows TableNodes))

func ToString

func ToString(n *html.Node) string

func VisitAll

func VisitAll(n *html.Node, callback func(*html.Node))

Types

type TableNodes

type TableNodes [][]*html.Node

func (TableNodes) At

func (tbl TableNodes) At(row, col int) *html.Node

Jump to

Keyboard shortcuts

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