Hello,
I’d like to announce the first release of htmlit (docs):
Htmlit is an OCaml library providing simple but subtle combinators for generating HTML fragments and pages.
Htmlit is distributed under the ISC license. It has no dependencies.
Install: opam install htmlit
(once this PR is merged).
Best,
Daniel
A big thanks to my donators.
10 Likes
It is interesting to see this! I have started using some of your other libraries and they are very impressive.
How would you compare Htmlit to tyxml, i.e., what was the motivation for creating Htmlit?
Htmlit does not try to type your HTML. To get a good compositionality story, it does a few tricks on class
and style
attribute specifications and supports direct fragment splicing in element childrens.
tyxml
tries to type your HTML which I find totally unusable in practice. I tried the tyxml
approach during some time in first decade of the century after @thomega came up with the technique twenty years ago.
I moved away from it quite quickly to prefer to treat HTML as an untyped assembly language rather than try to put lipstick on a pig. In my opinion the technique has terrible type and refactoring usability and still doesn’t prevent you of generating invalid HTML (e.g. no guarantee on id uniqueness). Honestly when you are dealing with the web, generating valid HTML is the least of your problem.
That was a long time ago; the copyright says 2016 but I’m pretty sure I used that in some more primitive form much before. The motivation is in the summary: to have a simple and usable library for generating HTML fragments or pages to send over the wire or store on your file system.
4 Likes