[ANN] dream-html 3.0.0

Hi, dream-html 3.0.0 has been released to opam: dream-html 3.0.0 · OCaml Package

Repo: GitHub - yawaramin/dream-html: Generate HTML markup from your OCaml Dream backend server
API docs: Dream_html (dream-html.Dream_html)

Dream-html is a library for generating HTML, closely integrated with Dream. It can be used as an alternative to Dream’s built-in Embedded ML templating language and comes with all current htmx attributes defined out of the box.

In this release, I made a breaking change (hence major version bump) to restrict the role attribute to only the acceptable values for ARIA roles. Previously it was accepting any format string.

Plus a major new feature: all the ARIA attributes with the types of their values narrowed as much as possible. Eg:

open Dream_html
open HTML

let toast ?(idval="toast") msg =
  p [id "%s" idval; Aria.live `polite; Hx.swap_oob "true"] [txt "%s" msg]

I’ve just released 3.0.1 with a bugfix for ARIA attribute names, please upgrade if you are using ARIA: dream-html 3.0.1 · OCaml Package

1 Like

I have converted my server to it… quite easy (any typing error is sanctionned by the OCaml compiler instead of silencely served to the client.).

Is the Dream — Tidy, feature-complete web framework page upgrade in progress ? I may also propose something, but prefer to have guidelines before working in a direction which won’t be approved.

Hi, thank you for trying it. I have not proposed anything to the Dream maintainer as I believe he prefers the Embedded ML template engine. Hence dream-html is strictly an alternative option.

EDIT: if you are interested in contributing to Dream I would suggest that the number 1 priority is to port it over to OCaml 5 (Multicore) and Eio to make it run multi-threaded. There is an open PR attempting it now. I have also been thinking of another approach, DM me if you are interested.