html

package
v0.0.0-...-ef76cd8 Latest Latest
Warning

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

Go to latest
Published: May 7, 2023 License: Unlicense Imports: 2 Imported by: 0

Documentation

Overview

Package html implements an HTML5-compliant tokenizer and parser.

Currently, this package serves as a wrapper for the Go development team's official HTML5 processing library ("golang.org/x/net/html"). For library documentation, consult the upstream Go library.

This package will most likely be rewritten in the future to use document.Node and other structures common to all document formats instead of html.Node, which is HTML-specific.

Index

Constants

This section is empty.

Variables

View Source
var ErrBufferExceeded = html.ErrBufferExceeded

Functions

func EscapeString

func EscapeString(s string) string

func Render

func Render(w io.Writer, n *Node) error

func UnescapeString

func UnescapeString(s string) string

Types

type Attribute

type Attribute = html.Attribute

type Node

type Node = html.Node

func Parse

func Parse(r io.Reader) (*Node, error)

func ParseFragment

func ParseFragment(r io.Reader, context *Node) ([]*Node, error)

func ParseFragmentWithOptions

func ParseFragmentWithOptions(r io.Reader, context *Node, opts ...ParseOption) ([]*Node, error)

func ParseWithOptions

func ParseWithOptions(r io.Reader, opts ...ParseOption) (*Node, error)

type NodeType

type NodeType = html.NodeType
const (
	ErrorNode NodeType = iota
	TextNode
	DocumentNode
	ElementNode
	CommentNode
	DoctypeNode
	RawNode
)

type ParseOption

type ParseOption = html.ParseOption

func ParseOptionEnableScripting

func ParseOptionEnableScripting(enable bool) ParseOption

type Token

type Token = html.Token

type TokenType

type TokenType = html.TokenType
const (
	ErrorToken TokenType = iota
	TextToken
	StartTagToken
	EndTagToken
	SelfClosingTagToken
	CommentToken
	DoctypeToken
)

type Tokenizer

type Tokenizer = html.Tokenizer

func NewTokenizer

func NewTokenizer(r io.Reader) *Tokenizer

func NewTokenizerFragment

func NewTokenizerFragment(r io.Reader, contextTag string) *Tokenizer

Jump to

Keyboard shortcuts

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