No description
Find a file
2026-10-04 19:55:30 +03:00
bin feat: serve rendered pages over http, spartan and nex 2026-10-04 19:55:30 +03:00
content feat: serve rendered pages over http, spartan and nex 2026-10-04 19:55:30 +03:00
core feat: serve rendered pages over http, spartan and nex 2026-10-04 19:55:30 +03:00
gemtext feat: serve rendered pages over http, spartan and nex 2026-10-04 19:55:30 +03:00
wap feat: serve rendered pages over http, spartan and nex 2026-10-04 19:55:30 +03:00
.gitignore feat: add workspace skeleton and server configuration validation 2026-10-04 19:01:35 +03:00
AGENTS.md feat: add workspace skeleton and server configuration validation 2026-10-04 19:01:35 +03:00
AI-DECLARATION.md feat: add workspace skeleton and server configuration validation 2026-10-04 19:01:35 +03:00
Cargo.lock feat: serve rendered pages over http, spartan and nex 2026-10-04 19:55:30 +03:00
Cargo.toml feat: serve rendered pages over http, spartan and nex 2026-10-04 19:55:30 +03:00
devbox.json feat: serve rendered pages over http, spartan and nex 2026-10-04 19:55:30 +03:00
devbox.lock feat: add workspace skeleton and server configuration validation 2026-10-04 19:01:35 +03:00
itsybitsy.toml feat: serve rendered pages over http, spartan and nex 2026-10-04 19:55:30 +03:00
LICENSE feat: add workspace skeleton and server configuration validation 2026-10-04 19:01:35 +03:00
README.md feat: serve rendered pages over http, spartan and nex 2026-10-04 19:55:30 +03:00
rustfmt.toml feat: add workspace skeleton and server configuration validation 2026-10-04 19:01:35 +03:00

🕸 itsybitsy

License: Apache-2.0 AI-DECLARATION: copilot

Serve folders of Markdown to different domains over HTTP, Spartan and Nex, rendered on the fly with no build step.

A Rust re-implementation of smolweb, which serves one folder from one process with its output formats hardcoded and its configuration in per-file frontmatter. itsybitsy changes all three: one process serves many domains, each output format is a separate crate behind a cargo feature, and configuration lives in a TOML file per content directory.

Status

It serves. HTTP, Spartan and Nex are working, with gemtext, XHTML-MP and HTML output and virtual hosting across all three.

Area State
Server configuration, virtual hosts, --check implemented
Path resolution, traversal containment, live reload implemented
Markdown parsing, includes, ASCII art, card breaks implemented
gemtext, XHTML-MP and HTML output implemented
HTTP, Spartan and Nex listeners, virtual hosting implemented
80-column text and Nex output planned
WML and XHTML-MP decks planned
Gemini and Gopher planned

Configuration

Two files. A server file names the virtual hosts and the listeners:

version = 1

[site.smol]
root = "/srv/smol/content"
hosts = ["smol.place", "www.smol.place"]

[listener.web]
protocol = "http"
bind = "0.0.0.0:8080"
formats = ["xhtmlmp", "html"]
default_site = "smol"

[listener.nex]
protocol = "nex"
bind = "0.0.0.0:1900"
formats = ["gemtext"]
site = "smol"

A page is rendered into the union of what the enabled listeners can serve, and no more: a configuration with no HTTP listener never builds any HTML. HTTP and Spartan route by the hostname the request carries, falling back to default_site; Nex carries none, so its listener names one site outright.

A .itsybitsy.toml in any content directory says how the Markdown in that directory renders. There is no inheritance: a subdirectory without its own file uses the built-in defaults rather than its parent's. Repetition in a deep tree is the price of never having to look elsewhere to know how a page renders.

[defaults]
cache_control = 3600

[page."index.md"]
title = "Notes"
cache_control = 300

[defaults] applies to every Markdown file in the directory; a [page."name.md"] table overrides it for one file. title is per-page by nature, so setting it in [defaults] is an error; left unset, it is derived from the page's first level-1 heading. Each renderer's own keys arrive with that renderer. Editing the file re-renders that directory's pages on the next request, and a file that fails to parse makes them error rather than silently falling back to defaults.

Because the name begins with a dot, the same rule that keeps .secret.md out of the URL space keeps this file out of it too.

--check validates the configuration and reports the routing it resolved, without binding a port:

$ itsybitsy --config /etc/itsybitsy.toml --check
sites:
  smol: /srv/smol/content
hosts:
  smol.place -> smol
  www.smol.place -> smol
listeners:
  web: http on 0.0.0.0:8080 [xhtmlmp, html] by host, default smol
formats rendered per page: html, xhtmlmp

Everything the schema cannot express is checked here rather than on first request: a format no enabled feature provides, two sites claiming one hostname, a content root that does not exist, a server file sitting inside a content root where it would be served.

Markdown

Markdown is parsed once per document into one representation that every output format reads, rather than once per format. Everything itsybitsy adds to CommonMark is either a construct other tools already understand or invisible to them, so a document stays portable:

Written Means
![[path]] splice that file's lines in here
![alt](art.txt) an image whose target is a text file, inlined verbatim
<!-- card Title --> a card divider, for formats that paginate
--- an untitled divider
<!-- center -->, <!-- right margin=4 --> alignment for the block that follows

Only the include is non-standard, and it is the spelling Obsidian and its relatives established; CommonMark renders it as literal text, which is why it is the one construct handled before parsing. The rest are ordinary HTML comments and images, interpreted after parsing — so an HTML comment that is not a recognised directive stays a comment, at the cost of a misspelled one doing nothing rather than complaining.

Alignment only reaches the fixed-width text formats; gemtext and HTML have no way to express it. An art label may carry its own :center, :left or :right token, which is removed from the label so it does not leak into the fallback text a gemtext or HTML client shows.

Include and art targets resolve relative to the file holding the reference and must stay inside the content root. Expansion is bounded on three axes — nesting depth, total lines, and total bytes — because a cycle check alone does not stop a long chain, and neither stops a diamond where two branches include the same file without ever repeating one on a single path.

Differences from smolweb

smolweb inherits five invented directives from its two renderer libraries: {.card}, {.include}, ![[ ]], #[label](art.txt) and MultiMarkdown attribute lists ({: .center}) — two incompatible brace grammars, with art alignment expressible two different ways in one line. None of it appeared in real content, so itsybitsy expresses the same capabilities with standard constructs instead. Parsing once rather than once per library also means the text formats gain setext headings and the WAP formats gain tables and ASCII art, none of which their original parser handled.

Output formats

Each format is a crate implementing one trait, compiled in behind a cargo feature. A renderer is handed the parsed document and may not open files or sockets, which is what keeps every path check in one place rather than in each format.

Format Served as Notes
gemtext text/gemini Unwrapped; Gemini and Spartan clients wrap for themselves
xhtmlmp application/vnd.wap.xhtml+xml Well-formed XML with the Mobile Profile doctype
html text/html The same markup without the XML declaration

HTTP negotiates between them from Accept. Only a literal media type counts as a match, so a browser's */* can never be read as willingness to receive a WAP format; ?format=<id> overrides negotiation outright, and naming an id the listener does not serve is a bad request rather than a silent fallback.

A third party adds a format by writing a crate that depends on itsybitsy-core, adding it to the workspace and one #[cfg] arm in the binary's registry, then naming its id in formats. Every listener's formats are checked against the registry at startup, so a format switched off by a feature is a configuration error naming the missing id rather than a server error on the first request.

URLs

Links should be root-relative and extensionless ([about](/about), not about.md), so the same link resolves identically from every protocol.

Request Serves
/ index.md
/foo foo.md, else foo/index.md
/foo.md redirects to /foo
/img.png the file itself, by media type

Nothing outside the content root is reachable. A request target is percent-decoded before it is normalised, so an encoded .. becomes a real one and gets clamped at the root rather than quietly matching nothing; any path component beginning with a dot is refused outright; and whatever survives is canonicalised and required to still be inside the root, which is what defeats a symlink pointing out of it. There are no generated directory listings — only index.md.

Development

devbox run check   # fmt --check, clippy -D warnings, test
devbox run test
devbox run build
devbox run run     # serve ./content on localhost

RUST_LOG sets the log level, which defaults to info: one line per request, and the real cause on failure.