3
Home
Virgil edited this page 2026-02-19 16:40:53 +00:00
Table of Contents
go-html
HLCRF DOM compositor with grammar pipeline integration. Pure-Go HTML rendering engine that generates semantic HTML5 using a declarative builder API.
Module: forge.lthn.ai/core/go-html
Go: 1.25.5
Dependencies: go-i18n (grammar pipeline), testify (tests only)
Licence: EUPL-1.2
Features
- HLCRF layout — Header-Left-Content-Right-Footer semantic region compositor
- Declarative nodes — Type-safe builder API with method chaining
- Grammar pipeline — Native go-i18n integration for text rendering and reversal
- Responsive variants — Multi-layout rendering with imprint comparison
- WebAssembly — Browser-side rendering via
window.gohtmlAPI - Web Components — Code generation for custom elements
- Safe by default — HTML-escaped output, XSS-safe
Text()nodes
Package Map
go-html/
├── node.go # Node interface + 8 node types
├── layout.go # HLCRF region compositor
├── responsive.go # Multi-variant wrapper
├── pipeline.go # Render → reverse → imprint pipeline
├── context.go # Rendering context (identity, locale, entitlements)
├── path.go # Block ID parsing for nested addressing
├── render.go # Convenience render function
├── codegen/ # Web Component JS generator
│ └── codegen.go
└── cmd/wasm/ # WebAssembly entrypoint
├── main.go # window.gohtml API
└── register.go # WC bundle builder
Quick Start
import html "forge.lthn.ai/core/go-html"
// Build a layout
layout := html.NewLayout("HCF").
H(html.El("h1", html.Text("site.title"))).
C(html.El("article",
html.El("h2", html.Text("page.heading")),
html.El("p", html.Text("page.body")),
)).
F(html.El("small", html.Text("site.copyright")))
// Render with context
ctx := html.NewContextWithService(i18nService)
output := layout.Render(ctx)
Build & Test
make test # Run all tests
make wasm # Build WASM (with size validation)
make clean # Remove dist/
Wiki Pages
- Architecture — HLCRF layout system, semantic regions, block IDs
- Node-API — Node interface, 8 node types, builder functions
- Pipeline — Grammar pipeline: render → reverse → imprint
- WebAssembly — WASM build, JS API, browser integration
- Code-Generation — Web Component class generation