fhtml

Get started

Install

A Rust toolchain is the only requirement for the compiler, which pulls in zero dependencies. Prefer JavaScript? Skip to @fhtml/core.

The compiler

Install straight from the repository with cargo. The second command adds the html2fhtml converter behind its feature flag.

$cargo install --path .the compiler
$cargo install --path . --features convert+ html2fhtml

Verify it: echo 'p "hi"' | fhtml should print <p>hi</p>.

Your first build

Write a .fhtml file and compile it. See the docs for the whole language.

terminalsh
echo 'section p-8 > h1 text-2xl font-bold "Hello"' > hello.fhtml
fhtml hello.fhtml
# → <section class="p-8"><h1 class="text-2xl font-bold">Hello</h1></section>

JavaScript & WASM

@fhtml/core is the compiler as WebAssembly plus dependency-free ESM glue, for Node, browsers, and edge runtimes where a native binary can't go. Subpaths cover the frameworks: /node reads includes from disk, /express is a view engine, /hono a renderer middleware.

$npm install @fhtml/corenode · browser · edge
app.jsjs
import { init, render } from "@fhtml/core";

await init();
const { html } = render('div grid\n  span rounded "hi"\n');
server.jsjs
import { engine } from "@fhtml/core/express";

app.engine("fhtml", engine());
app.set("view engine", "fhtml");
app.get("/", (req, res) => res.render("page", { name: "hi" }));

Vite

vite-plugin-fhtml lets you import .fhtml files directly. It's dependency-free and shells out to the installed fhtml binary.

vite.config.jsjs
import fhtml from "vite-plugin-fhtml";
export default { plugins: [fhtml()] };

Tailwind

Tailwind v4 scans .fhtml sources directly — the classes are plain space-separated tokens. Add one @source line to your CSS entry.

input.csscss
@import "tailwindcss";
@source "./src/**/*.fhtml";

Editor support

Install the extension from the VS Code Marketplace or Open VSX (VSCodium, Cursor). Syntax highlighting works with zero setup; once the compiler above is installed, a language server backs diagnostics, formatting, symbols, definitions, and completion. The grammar covers the full language including the template layer.

Installed?

Head to the docs to learn the language, or skim what shipped.