HyperMarkDown¶
An AI-ready document language for humans and machines.
Built on the simplicity of Markdown, HyperMarkDown brings together wiki links, structured metadata, rich visuals, semantic relationships, and executable HQL cells. Write documents, connect ideas, build a mesh of knowledge, and bring it to life through computation and AI.
# VS Code: preview, graph, cells
code --install-extension hypermarkdown.hmd
# hmd: the linter and site builder
pip install HyperMarkDown
The tools implement HyperMarkDown 0.1, the released specification.
- [[login]]
- [[logging]] — the **auth** logging card, not the general one
- [[tokens]] — the **auth** tokens card, not the shared one
Two cards are named logging and two tokens. A name is looked up in the card's own folder first.
Tokens rotate every 24 hours, and a rotated token stays valid for a 60-second
overlap so in-flight requests are not cut off. ^rotation-window
A token is issued only after a completed [[login]] flow. The issuing service
never reuses a subject's previous token, even when the previous one is still
inside its rotation overlap:
![[/shared/tokens#^rotation-window]]
A token is issued only after a completed login flow. The issuing service never reuses a subject's previous token, even when the previous one is still inside its rotation overlap:
```d2
client -> edge: credentials
edge -> auth: verify
auth -> edge: token
edge -> client: token + rotation window
```
```hql#eval id=books
cards
| filter(c => c.name != "contents")
| sort(by = c => c.title)
```
One card added to the example vault, and what hmd lint then prints.
See [[tokens]] for the lifetime rules.
glossary/index.hmd:11:3: warning[HMD001] [[idempotency]] does not resolve to a page
notes.hmd:1:5: error[HMD002] [[tokens]] matches 2 pages; qualify it (candidates: shared/tokens.hmd, specs/auth/tokens.hmd)
1 error(s), 1 warning(s)
One file, three layers¶
A card is one text file, .hmd or .md. CommonMark is the base. HyperMarkDown specifies the hyper layer on top of it, and its tools always enable the rich layer between them.
notes.hmd
Hyper layer
defined by HyperMarkDown: naming another card, or a part of one
[[card]][[card#Section]][[card#^block]]![[embed]]^block- frontmatter
Rich layer
Markdown extensions, enabled in every tool with no switch
- tables
- task lists
- footnotes
- callouts
- collapsible sections
- TeX
- D2 diagrams
CommonMark
inherited whole
- headings
- lists
- emphasis
- links
- images
- block quotes
- fenced code
Markdown stays valid¶
Every CommonMark document is a syntactically valid card. Three things gain a
meaning: [[…]] is a link, a trailing ^name names a block, and a ---
block at the top is frontmatter. The rich layer adds its own syntax, such as
$…$ and !!!.
Markdown files are cards¶
Inside a vault, a directory with a .hmd/ directory in it, a .md file is a
target for links and embeds without being renamed. Rename it to .hmd when its
own links should be checked.
The language has a specification¶
The Language Specification states the grammar of links, embeds, anchors and frontmatter, the resolution rules and the diagnostics, over CommonMark 0.31.2. Cells are defined by HQL, not by it.
Links name cards¶
[[tokens]] is resolved by name. A folder of cards is a vault, its cards and links are a graph, and hmd lint checks every [[link]] and ![[embed]] in it.
- link
- embed
- red link, a warning
What you write
[[card]]- a link to a card, found by name
[[card|words]]- the same link, showing other words
[[card#Heading]]- a link to a section of that card
text ^name- a block anchor: a name for one block
[[card#^name]]- a link to that block
![[…]]- an embed: any of the above, placed in the page
How a name is found
1 · Named imports
a name this card imported: from /shared import tokens
2 · The spine
the card's own folder, then each parent folder up to the root
3 · Imported paths
each from … import *, in the order written
4 · Autodiscovery
one sweep of the whole vault. Two matches are error HMD002
The first step that finds the name wins. In the graph, specs/auth/login imports shared/tokens under the name shared-tokens, because a bare tokens there is the card in its own folder. A name that is found nowhere is a warning, a red link: a link can be written before its card. Ordinary Markdown links are not checked. The full rules are in Namespaces.
Cards made of cards¶
Put ! in front of a link and the target is placed in the page instead of linked. A definition is written once and embedded where it is needed.
glossary/token.hmd
Token
A bearer credential presented on every request, scoped to one subject and one audience, and valid only until it expires. ^definition
The block above carries the anchor ^definition, so other cards can embed the one sentence rather than the whole page.
![[token#^definition]]
specs/auth/login.hmd
Login
The glossary definition, embedded by block anchor rather than restated:
A card, a section, or a block¶
![[shared/tokens]] embeds the whole card, ![[shared/tokens#Rotation]]
one section, and ![[shared/tokens#^rotation-window]] one named block.
Embeds are linted¶
An embedded card can embed others. A cycle is an error, and so is nesting deeper than 16 levels. A missing target is reported like a missing link.
In the editor and on export¶
The editor preview shows an embed as an embed, with the card it came from.
hmd render writes one flat Markdown or HTML file with every embed expanded.
Metadata¶
A card can open with YAML frontmatter. The tools read four keys. Every other key is yours.
Four keys the tools read
---
tags: [area/auth, status/accepted]
use: [no_autodiscovery]
import:
- from /shared import tokens as shared-tokens
- from /glossary import *
nav:
order: 10
visibility: public
---
tags- what the card is about.
/separates levels use- switches for the card or its folder. Today there is one: autodiscovery
import- names brought in from other folders
nav- the card's place in a published site. A card is published only when
visibilityispublic
Your keys, read by a query
---
title: Emma
metadata:
author: Jane Austen
status: todo
---
```hql#query id=todo
books | filter(c => c.metadata.status == "todo")
```
```hql#eval
todo | map(c => c.title)
```
- Emma
- The Hobbit
Two of the four book cards have status: todo. The two fences are cells: queries that run inside a card, described under Cards are notebooks. HQL reads the keys under metadata: as c.metadata, and any other key as c.header.
Visuals¶
A diagram, a formula and a callout are text in the card. They are reviewed in a diff like the prose around them.
Diagram
```d2
direction: right
card -> preview: editor
card -> site: publish
card -> answer: query
```
Mathematics
Attempt $n$ is delayed by the shared backoff formula with $b = 2$ seconds:
$$
t_n = U\bigl(0,\; \min(t_{max},\; b \cdot 2^n)\bigr)
$$
Attempt \(n\) is delayed by the shared backoff formula with \(b = 2\) seconds:
Callout
!!! note "Why per subject"
Throttling per address punishes shared egress and misses the attack it is
meant to stop.
Why per subject
Throttling per address punishes shared egress and misses the attack it is meant to stop.
Task list
- [ ] Decide whether step 2 emits an audit event
- [x] Confirm the throttle key is the subject
- Decide whether step 2 emits an audit event
- Confirm the throttle key is the subject
Diagrams are D2 and mathematics is TeX. Tables, footnotes, collapsible sections and strikethrough render in the editor preview and on a site too. Where the d2 program is not installed, a diagram is shown as its own source with a label. Every construct is shown working in Features.
Cards are notebooks¶
A card can hold HQL cells. A cell is a query, it runs, and its output is written into the card as Markdown.
Three kinds of fence
```hql#eval- a cell. It runs, and its output is saved under it
```hql#query- a cell that prints nothing. Other cells read its value
```hql- a listing. It is an ordinary Markdown code block and is never run
```hql#eval
{books: books | size, to_read: todo | size}
```
<!-- hql:output hash=779c4eb751ef status=ok -->
| key | value |
| ------- | ----- |
| books | 4 |
| to_read | 2 |
<!-- /hql:output -->
The output sits between two comments, so the card reads the same in any Markdown viewer, with or without HQL installed.

Cells read each other
hql#eval id=books
cards | filter(…) | sort(…)
every card but this one, by title
hql#query id=todo
books | filter(…)
reads books, keeps the unread ones
hql#eval
{books: …, to_read: …}
reads both, writes the table
Run in order¶
A cell with id= gives its value a name. Cells run in the order their reads
require, and a cell that reads a failed cell is skipped.
Stale output is detected¶
The hash on an output covers the cell's code and the code of every cell it reads. The editor marks a cell current or stale without running it.
Two ways to run¶
The VS Code extension runs a cell from a button in the preview and saves its
output. hql render runs a card's cells from the command line.
HQL is a strongly typed expression and query language, and a separate project. A cell can query the vault's cards, their metadata and their links, and the same pipelines read JSON, YAML, SQLite, PostgreSQL, Kafka, NATS and lakehouse tables. Its documentation is at hql-lang.org. What each kind of value is written as is Cell output.
Search by meaning¶
hmd-semantics embeds each card, and each question you name, into one index file. HQL ranks cards for those questions without a model, and then follows their links.
Vault
.hmdcards.mdcards
Build
hmd-semantics build
embeds each card, and each question given as --query, with a local model or an HTTP endpoint
Index
.hmd/index.sqlite
one file, named by [semantics] index in the vault's config. verify reports when it no longer matches the cards
Query
cards | semantic("night hunting birds") | take(3) | expand(depth = 1)
the three closest cards, and every card one link away
No model at query time¶
The vectors are computed once, at build. A query reads them from the index, so it runs offline and gives the same ranking each time.
Questions are named at build¶
A question has to be named with --query when the index is built. A query
for any other string is an error that says to rebuild.
One vector per card more planned¶
Each card is embedded whole. Indexing a one-paragraph and a one-sentence summary of each card beside it is planned and not built.
The result is cards, so it is Markdown: add | text and the ranked cards and their neighbours print as one document, which is what a language model takes as context. The index builder and HQL are separate installs, listed under Tools.
Tools¶
Seven tools read, check, draw or query cards. One more is planned.
- VS Code extension editor Live preview, the vault's graph, diagnostics, and Run buttons on cells.
- hmd command line · Python
lint,render,graph,initandinfoover a tree of cards. - MkDocs plugin site Builds a tree of cards into a website. It built this one.
- @hypermarkdown/core library · TypeScript Parser, resolver and renderer. The extension's preview runs on it.
- hypermarkdown library · Rust The resolver as a crate. It does not lint or render.
- hmd-semantics index builder · Python Builds and verifies a vault's semantic index.
- HQL query language · Rust Runs the cells. A separate project with its own documentation.
- Language server planned Completion, rename and hover, for editors other than VS Code too.
The specification decides what a card means. The Python, TypeScript and Rust implementations run the same test cases, and where neither settles a question the Python tool's behaviour stands. Cells run in the editor and through HQL; hmd and the site build do not run them. A card is plain text, so any editor, GitHub or a chat window shows its source; what each viewer draws is Presentation.
How it compares¶
What each format does about links by name, embeds, checking and cells.
| What it is | Links by name | Embeds | Links checked | Cells that run | Readable as plain text | Specification | |
|---|---|---|---|---|---|---|---|
| HyperMarkDown | Markdown with links by name, embeds, metadata and cells | [[card]], to a card, a heading or a block |
![[card#^block]]: a card, a section or a block |
hmd lint: every [[link]] and embed, from the command line |
HQL cells; output saved in the card | Yes | Yes, for links, embeds and metadata; HyperMarkDown 0.1, released |
| CommonMark | Markdown specification | Paths and URLs | No | Not part of the specification | No | Yes | Yes |
| GFM | CommonMark with tables, task lists, strikethrough and autolinks | Paths and URLs | No | Not part of the specification | No | Yes | Yes |
| Obsidian | Note-taking app over Markdown files | [[Note]], to a note, a heading or a block |
![[Note#^block]]: a note, a heading or a block |
In the app; its CLI lists unresolved links while the app runs | Not built in | Yes | Help pages; no formal specification |
| MDX | Markdown with JSX, compiled to JavaScript | Paths and URLs | A whole file, imported as a component | Not documented | JSX, evaluated when the compiled page runs; no output in the source | Markdown with JSX | No current specification |
| Jupyter | JSON notebook of code and Markdown cells | Paths and URLs | No | Not documented | Kernels; outputs saved in the file | No, JSON | Yes, a JSON schema |
| Quarto | Pandoc Markdown with executable blocks | Paths | {{< include >}}, a whole file |
Not documented | knitr or Jupyter; output goes to the rendered document | Yes | Documentation; no formal specification |
| Org-mode | Emacs outline and markup format | File paths, or the ID of a headline | #+INCLUDE, at export: a file, a headline or lines |
org-lint |
Babel; results saved in the file | Yes | A community syntax document |
Each row other than the first was checked against that project's own documentation on 2026-11-22. "Not documented" means the documentation does not say. The columns are the things HyperMarkDown is for. It is also the youngest row: a first 0.x specification, one editor extension, and GitHub shows a .hmd file as source and does not render it.
Read on¶
- Vision A web of plain text pages that people, programs, and AI agents can read.
- Namespaces Cards, directories, and reference resolution.
- Features What a card can carry, shown working.
- Language Specification The normative text: grammar, resolution, diagnostics.
- Introduction The format at a glance, and how to adopt it one file at a time.
- Tutorial Build a reading club vault and generate a reading list with HQL.
- Cell output What each kind of value is written as, and how to choose a format.
- Presentation Editor, site and plain text: what each one shows.
- Roadmap Released versions, what works today, and what is coming.
Start¶
In the editor¶
The VS Code extension previews a card as you type and runs its cells.
code --install-extension hypermarkdown.hmd
On the command line¶
hmd checks every [[link]] and ![[embed]] in a vault.
pip install HyperMarkDown
hmd init
hmd lint
What each install gives you is the Quick start. The tools implement HyperMarkDown 0.1; released versions are on the Roadmap. Code is MIT, documentation and specifications are CC BY 4.0.