DEV Community

Mondi
Mondi

Posted on

htmforge v0.4.0 released

v0.4.0

One week out — here's what changed.


Added

Page.lang

The Page component now accepts a lang field that sets the
lang attribute on the <html> element:

class MyPage(Page):
    def _body_content(self):
        return [div(h1("Hello"))]

MyPage(title="Home", lang="de").to_html()
# <!DOCTYPE html><html lang="de">...
Enter fullscreen mode Exit fullscreen mode

Default is "en". Small thing, but accessibility tools and
screen readers depend on it — it was an obvious gap.


Component.to_json()

Useful for API endpoints that need to return rendered HTML
alongside metadata:

card = UserCard(name="Ada", role="admin")
card.to_json()
# {"html": "<div class='card'>...", "component": "UserCard"}
Enter fullscreen mode Exit fullscreen mode

Trusted Publishing

Optional CI-based publish path via GitHub Actions —
no local API token needed anymore.
Documented in docs/guide/trusted-publishing.md.


Changed

hatch-vcs

Version is now sourced directly from git tags.
No more manual version bumps in pyproject.toml
tag the commit, the version follows automatically.

[tool.hatch.version]
source = "vcs"
Enter fullscreen mode Exit fullscreen mode

release.py and push.py now read the version
from the git tag instead of pyproject.toml.


Fixed

  • README: all relative links replaced with absolute GitHub URLs for correct rendering on PyPI
  • DataTable docs updated — ColumnDef, dict_rows, sort_url, current_sort, sort_dir, empty_message now fully documented
  • docs/guide/components.md: broken code block fences and garbled method names fixed
  • CONTRIBUTING.md: Good First Issues updated to reflect actual open tasks

Install

pip install --upgrade htmforge
Enter fullscreen mode Exit fullscreen mode

👉 github.com/mondi04/htmforge

👉 Full changelog

Top comments (0)