HTX Guide · 1.5.0-alpha.2
Introduction
What HTX is, why to use it, and how to get started with HTX 1.5.0-alpha.1.
HyperToken eXpressive (HTX) is a markup language between Markdown and HTML. You keep familiar Markdown ergonomics — headings, emphasis, lists, links — and add explicit structure with :: blocks, components, security profiles, and a canonical JSON AST.
HTX 1.5.0-alpha.2 ships a reference compiler, WASM playground, VS Code extension, and language server. Documents compile to HTML (and other profiles) without executable JavaScript in source files.
What is HTX?
Markdown is excellent for prose but weak for layout, components, and trust boundaries. HTML is powerful but noisy and unsafe when authors paste untrusted input. HTX sits in the middle:
- Explicit blocks — every region opens with
::tagand closes with::on its own line - Markdown inside blocks — write headings, lists, and emphasis as you already do
- Components with slots — structured UI regions without JSX or imports
- Security profiles — quarantine untrusted content at parse time
- One AST — JSON is the contract; HTML is a compile target
::section { #hero .p-8 }
## Welcome
Status: :span{.text-green}[Operational]
::
Why use HTX?
| Goal | HTX approach |
|---|---|
| Predictable structure | :: closers — never infer nesting from indentation alone |
| Author-friendly | CommonMark subset + optional GFM tables |
| Safe rendering | No raw HTML pass-through; html-sanitize profile for user content |
| Tooling | Diagnostics HTX001–HTX014, formatter, LSP hover and go-to-definition |
| Agents | Canonical AST and stable error codes for automated authoring |
How HTX works
- Write an
.htxfile with optional YAML frontmatter. - Parse into a canonical JSON AST (strict, streaming, or security-profile modes).
- Transform — tag registry, references, trust annotations, optional GFM.
- Compile to HTML, sanitized HTML, or web components.
Try step 1–4 in the playground without installing anything. Browse examples for dashboards, components, and security profiles.
Install the CLI
Build from the HTX repository (public registry publish is planned):
git clone https://github.com/hypertoken/htx.git
cd htx
cargo build -p htx-cli --release
# Binary: target/release/htx
Then compile a document:
htx compile my-document.htx -o output.html
htx parse my-document.htx --ast
htx format my-document.htx --check
Next steps
- Quickstart — learn core syntax in ~30 minutes
- Syntax reference — block directives, inline tags, diagnostics
- What’s available — full capability matrix
- Examples — curated fixtures with live previews
- Specification — normative behavior