This is definitely not the fastest HTML/XML parser that runs on JavaScript but is very small and simple, just so it can be easily modified.
The purpose of this project is to be a quick start for playing with PEG.js and especially for those who love LiveScript.
If you want to know more about PEGs syntax and flavors here are the fun staff - Parsing expression grammars.
The whole PEG HTML parser squeezed without comments and empty lines. It is really a collection of grammar rules from which PEG.js can generate JS parser. My inspiration for writing HTML grammar rules was of course W3C HTML5 syntax recommendation.
Checkout the repo and install node dependencies.
npm iOptionally, for syntax highlighting in Sublime Text editor, you can install PEGjs LiveScript plugin.
On every save of the parser ./src/peg-html-parser.pegls all *.html files from ./test/fixtures will be parsed and the result of parsing and AST will be written in ./.watch folder in YAML format.
npm run watchGenerates the JS parser to ./dist folder (only CommonJS module style).
npm run buildExecutes tests and parses all *.html files from ./test/fixtures.
npm test