Fork me on GitHub
Vincent Cantin08:03:20

A tiny (~50 LOC) cross-platform CLJC library which parses html into an AST, and then converts it to hiccup. A very good starting point for any html hacking (easy to fork and edit).

🙌 20
👍 10
🎉 11
💯 4
Noah Bogart12:03:38

I saw you post the gist on Twitter. Glad you turned it into a full library!

Vincent Cantin12:03:54

Thx. I think a library makes it easier to maintain and link to it.

Vincent Cantin12:03:45

The lib has a place for automated tests as well.


This looks great 👏 Presumably the parser is much more strict on well formedness than html5 and browsers? Regardless this looks very useful!

Vincent Cantin13:03:32

I would say that it is less strict than the browser. For example, there is no check that a closing element has the same tag as its opening element. The parser is not supposed to be used to validate html, just to convert it when it is assumed to be correct.

Vincent Cantin13:03:47

By the way, I released the version 0.1.3 with the new helper function minify-hiccup. To know how it works, see its unit tests.

Cora (she/her)04:04:37

also maybe useful for the same thing is hickory, I think?

Vincent Cantin05:04:13

Hickory in CLJS nequires the DOM nodes of a browser for the parsing. This one doesn't.

Cora (she/her)07:04:30

oh!! very excellent point!!