package gohtml import ( "golang.org/x/net/html" "io" "strings" ) // parse parses a stirng and converts it into an html. func parse(r io.Reader) *htmlDocument { htmlDoc := &htmlDocument{} tokenizer := html.NewTokenizer(r) for { if errorToken, _, _ := parseToken(tokenizer, htmlDoc, nil); errorToken { break } } return htmlDoc } // Function that identifies which tags will be treated as containing preformatted // content. Such tags will have the formatting of all its contents preserved // unchanged. // The opening tag html.Token is passed to this function. // By default, only
and