Default tree format for parse5.
Quite popular htmlparser2 tree format (e.g. used by cheerio and jsdom).
Parses an HTML string.
Input HTML string.
Parsing options.
Parses an HTML fragment.
Parsing context element. If specified, given fragment will be parsed as if it was set to the context element's innerHTML property.
Input HTML fragment string.
Parsing options.
Serializes an AST node to an HTML string.
Node to serialize.
Serialization options.
Generated using TypeDoc
Provides built-in tree adapters that can be used for parsing and serialization.
const parse5 = require('parse5'); // Uses the default tree adapter for parsing. const document = parse5.parse('<div></div>', { treeAdapter: parse5.treeAdapters.default }); // Uses the htmlparser2 tree adapter with the SerializerStream. const serializer = new parse5.SerializerStream(node, { treeAdapter: parse5.treeAdapters.htmlparser2 });