Skip to content
oklarPublic

About

A language agnostic hypertext markup builder

Topics

Resources

Stars

6 stars

Watchers

2 watching

Forks

Latest commit

 

History

54 Commits

Folders and files

Repository files navigation

HTMB - Hypertext Markup Builder

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.

Implementations

HTMB is available in multiple languages:

All of them share one tag list and one set of test cases, in documentation.

Core Concept

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>

Releasing

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.0

The 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 htmb package's settings, add a trusted publisher for GitHub Actions with user oklar, repository htmb and workflow file release.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, repository htmb and workflow file release.yml.

License

MIT, see LICENSE.

About

A language agnostic hypertext markup builder

Topics

Resources

Stars

6 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages