A minimalistic library for building HTML structures using pure functions. HTMB provides a clean, simple API for generating HTML for as many programming languages as possible.
HTMB is available in multiple languages:
All of them share one tag list and one set of test cases, in documentation.
HTMB uses a functional approach to HTML generation, representing elements as function calls:
// Pseudocode example
div(
h1("Hello World"),
p("Welcome to HTMB")
)
This produces HTML like:
<div>
<h1>Hello World</h1>
<p>Welcome to HTMB</p>
</div>Each library is released on its own by pushing a tag. Bump the version in the library's file, merge it to main, then tag that commit:
| Library | Version lives in | Tag | Publishes to |
|---|---|---|---|
| C | c/library.json |
c-v2.1.1 |
Nothing to upload: PlatformIO users pin the tag in lib_deps |
| C# | cs/HtmbLibrary/HtmbLibrary.csproj |
cs-v2.3.0 |
NuGet |
| JavaScript | js/package/package.json |
js-v1.3.0 |
npm |
The tag's message becomes the GitHub release: its first line is the title and the rest is the notes.
git tag -a js-v1.4.0 -m "htmb 1.4.0 for JavaScript" -m "- What changed, one line each"git push origin js-v1.4.0The release workflow checks that the tag is on main and matches the version. For cs-v* and js-v* tags it then runs the tests and publishes the package, and for every tag it creates the GitHub release. Publishing uses trusted publishing, so the repo holds no API keys. That needs a one-time setup on each registry:
- npm: on npmjs.com, open the
htmbpackage's settings, add a trusted publisher for GitHub Actions with useroklar, repositoryhtmband workflow filerelease.yml, and tick npm publish under allowed actions. (Without it, npm only allows staged publishes, which wait for you to approve them.) - NuGet: on nuget.org, open Trusted Publishing from your username menu and add a policy with repository owner
oklar, repositoryhtmband workflow filerelease.yml.
MIT, see LICENSE.