index.js
1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
'use strict';
var Parser = require('./parser'),
Serializer = require('./serializer');
// Shorthands
exports.parse = function parse(html, options) {
var parser = new Parser(options);
return parser.parse(html);
};
exports.parseFragment = function parseFragment(fragmentContext, html, options) {
if (typeof fragmentContext === 'string') {
options = html;
html = fragmentContext;
fragmentContext = null;
}
var parser = new Parser(options);
return parser.parseFragment(html, fragmentContext);
};
exports.serialize = function (node, options) {
var serializer = new Serializer(node, options);
return serializer.serialize();
};
// Tree adapters
exports.treeAdapters = {
default: require('./tree_adapters/default'),
htmlparser2: require('./tree_adapters/htmlparser2')
};
// Streaming
exports.ParserStream = require('./parser/parser_stream');
exports.PlainTextConversionStream = require('./parser/plain_text_conversion_stream');
exports.SerializerStream = require('./serializer/serializer_stream');
exports.SAXParser = require('./sax');