hecrj / html-parser

Parse HTML 5 in Elm
https://package.elm-lang.org/packages/hecrj/html-parser/latest/
BSD 3-Clause "New" or "Revised" License
61 stars 25 forks source link

Add HTML document support and tests. #15

Closed 4onen closed 4 years ago

4onen commented 4 years ago

Targeted at solving #12 in a basic, legacy-supporting way. Adds Document type, document parser, runDocument parsing command, and documentToString un-parsing command. It also splits up the nodeToString parsing function into more general pieces, which are re-used in documentToString.

I also made a slight change to the comment-to-string conversion because it was adding spaces to the HTML comments if I parsed a document then to-stringed it then parsed the string again. Now it doesn't do that and, as far as I can tell, still matches the HTML living standard.

Fixes #12.