Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
inikulin committed Feb 28, 2014
1 parent fac7a30 commit 8d6d64c
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,8 @@ So, parse5 is as fast as simple specification incompatible parsers and ~15-times

##API reference

---------------------------------------


###Enum: TreeAdapters
Provides built-in tree adapters what can be passed as an optional argument to the `Parser` and `TreeSerializer` constructors.

Provides built-in tree adapters which can be passed as an optional argument to the `Parser` and `TreeSerializer` constructors.

####• TreeAdapters.default
Default tree format for parse5.
Expand All @@ -56,12 +52,11 @@ Default tree format for parse5.
####• TreeAdapters.htmlparser2
Quite popular [htmlparser2](https://github.com/fb55/htmlparser2) tree format (e.g. used in [cheerio](https://github.com/MatthewMueller/cheerio) and [jsdom](https://github.com/tmpvar/jsdom)).


---------------------------------------


###Class: Parser

Provides HTML parsing functionality.

####• Parser.ctor([treeAdapter])
Creates new reusable instance of the `Parser`. Optional `treeAdapter` argument specifies resulting tree format. If `treeAdapter` argument is not specified, `default` tree adapter will be used.
Expand All @@ -78,6 +73,7 @@ var parser2 = new parse5.Parser(parse5.TreeAdapters.htmlparser2);
```



####• Parser.parse(html)
Parses specified `html` string. Returns `document` node.

Expand All @@ -98,12 +94,10 @@ var documentFragment = parser.parseFragment('<table></table>');
var trFragment = parser.parseFragment('<tr><td>Shake it, baby</td></tr>', documentFragment.childNodes[0]);
```


---------------------------------------


###Class: TreeSerializer

Provides tree-to-HTML serialization functionality.

####&bull; TreeSerializer.ctor([treeAdapter])
Creates new reusable instance of the `TreeSerializer`. Optional `treeAdapter` argument specifies input tree format. If `treeAdapter` argument is not specified, `default` tree adapter will be used.
Expand Down Expand Up @@ -134,7 +128,6 @@ var html = serializer.serialize(document);
var bodyInnerHtml = serializer.serialize(document.childNodes[0].childNodes[1]);
```


---------------------------------------


Expand Down

0 comments on commit 8d6d64c

Please sign in to comment.