Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
137 commits
Select commit Hold shift + click to select a range
b7f5361
Works towards HyperDoc 2.0
Dec 22, 2025
f2d3b56
Fixes some spec parts
Dec 22, 2025
13b8b6b
More spec improvements
Dec 22, 2025
71f0bf8
Adds example files.
Dec 22, 2025
6a8f864
Removes the dependencies for now.
Dec 22, 2025
83bf570
Adds AGENTS.md
Dec 22, 2025
460bd94
Vibecoded: Adds tokenizer for the new HyperDoc format
Dec 22, 2025
f6e6757
Starts to rework specification to have improved definition and setup.
Dec 23, 2025
f5c13ea
Implements new parser for HyperDoc 2.0
Dec 23, 2025
0bd2f1a
Adds functions for test suite, adds fuzzer code
Dec 23, 2025
715f53f
Vibecoded: Implements DOM datastructure, adds diagnostic error messag…
Dec 24, 2025
46cdc65
Introduces more types into the DOM, adds basics for attribute parsing.
Dec 24, 2025
986cf05
Vibecoded: Adds dump code in main.
Dec 24, 2025
5ccfcbf
Prepares node translation by stubbing out block layer.
Dec 24, 2025
c9b32d5
Streamlines some parts of the processor the improve the code structure.
Dec 25, 2025
5979ab7
Vibecoded: Implements date/time parsing, improves spec
Dec 25, 2025
53f0946
Improves spec a lot
Dec 25, 2025
ba40f2c
Refactors Parser.Node.attributes from map to list, so the lexical str…
Dec 26, 2025
50b4093
Fixes failing test.
Dec 26, 2025
8f83120
Implements translation of H1 nodes and basic inline contents.
Dec 26, 2025
c3ff7bc
Implements most guts of the inline composition system, but only expos…
Dec 26, 2025
349ada5
Implements most inline node translations except for the date/time parts.
Dec 26, 2025
0f68155
Vibecoded: Reduces the verbosity of the debug dump output
Dec 26, 2025
16123ed
Implements basic validation of reference and uri attributes.
Dec 27, 2025
088c51e
Prepares most of the date/time inline parsing, except for the span to…
Dec 27, 2025
fa5d31a
Simplifies sema.emit_diagnostic by taking a Parser.Location
Dec 27, 2025
67f9a10
Moves code around
Dec 27, 2025
98ee909
Implements SemanticAnalyzer.unescape_string
Dec 28, 2025
01e548c
Simplifies diagnosticCodesEqual with metaprogramming.
Dec 28, 2025
02379db
Fixes an edge case in unescape_string. Adds fuzzing for string unesca…
Dec 28, 2025
f993c3e
Implements translation of paragraph nodes.
Dec 28, 2025
709423c
Implements join_spans to enable date/time parsing, fixes bad example.
Dec 28, 2025
535c411
Implements new attribute hdoc(tz) which provides a timezone hint for …
Dec 28, 2025
93fc34b
Adds tests for Date/Time/DateTime.parse
Dec 28, 2025
103bdec
Adds parsing of lists and list nodes.
Dec 28, 2025
fa37e8b
Fixes missing fallback for ol having first==1
Dec 28, 2025
035ac7c
Vibecoded: Implements rest of the node types, adds TODO comments for …
Dec 28, 2025
40d82be
Moves dump code into src/render/dump.zig
Dec 29, 2025
98d386e
Cleans up main a bit and implements diagnostic printing.
Dec 29, 2025
76d4085
Unifies handling for empty spans
Dec 29, 2025
0c77468
Implements span compaction for regular 'single whitespace' join spans…
Dec 29, 2025
923d01f
Implements p/pre split for whitespace compaction
Dec 29, 2025
73763b7
Resolves several TODOs: Table shape (column count) validation, date/t…
Dec 29, 2025
68eb43e
Implements id uniqueness check.
Dec 29, 2025
cdd8245
Spec/code alignment: Allows trailing commas in attribute lists, allow…
Dec 29, 2025
b8f36e2
Refactored code to use LanguageTag and TimeZoneOffset instead of ?[]c…
Dec 29, 2025
075821c
Vibecoded: Resolves all diagnostic-related TODOs
Dec 29, 2025
1a61967
Moves some tests from hyperdoc.zig to testsuite.zig
Dec 29, 2025
2742637
Improves specification and fixes some minor mismatches in implementation
Dec 30, 2025
734c499
Updates spec to have hdoc(date=...) be a DateTime value, so the autho…
Dec 30, 2025
949ec59
Prepares HTML5 rendering task.
Dec 30, 2025
27b6583
Adds new spec draft
Dec 30, 2025
0891fcf
Implement automatic table of contents generation
ikskuh Dec 30, 2025
815407b
Merge pull request #3 from Ashet-Technologies/codex/implement-automat…
ikskuh Dec 30, 2025
6bd87f8
Adjust golden fixtures and table rendering semantics
ikskuh Dec 31, 2025
9ed5232
Merge pull request #4 from Ashet-Technologies/codex/implement-html5-r…
ikskuh Dec 31, 2025
71315b1
Overhauls docs/specification-proper-draft.md with an additional AGENT…
Dec 31, 2025
d8e7388
Adds two new TODOs to the Table type
Dec 31, 2025
92eef4a
Implements basic CLI parser
Dec 31, 2025
988520e
Fixes bug in span merger that would prevent leading whitespace of ele…
Dec 31, 2025
8a6e302
Updates spec to include \footnote, footnotes{}, \ref and updated \link.
Dec 31, 2025
effbb39
Vibecoded: Cleans up specification and fixes internal consistency iss…
Dec 31, 2025
f57acfb
Add spec compliance TODOs
ikskuh Dec 31, 2025
3424392
Update spec TODOs
ikskuh Dec 31, 2025
34bc69b
Merge pull request #5 from Ashet-Technologies/codex/review-docs-to-sy…
ikskuh Dec 31, 2025
8af92db
Revert inline-node clarification for string/verbatim bodies
ikskuh Dec 31, 2025
6696c29
Merge pull request #6 from Ashet-Technologies/codex/review-docs/speci…
ikskuh Dec 31, 2025
ee8504b
Stop trimming verbatim lines
ikskuh Jan 1, 2026
df80678
Merge pull request #7 from Ashet-Technologies/codex/implement-whitesp…
ikskuh Jan 1, 2026
f4cde94
Implements hdoc(date) respecting hdoc(tz) default.
Jan 1, 2026
d1af43f
Implements \date, \time and \datetime reject anything except bare tex…
Jan 1, 2026
1da78c3
Refactory Block.TableOfContents.depth to non-optional value between 1…
Jan 1, 2026
59cbae2
Rewrites §7.5 Identifiers and References
Jan 1, 2026
fe9218b
Restructures chapter 8 (Elements and attributes) into a more well-for…
Jan 1, 2026
eadc76e
Changes note/warning/... from paragraphs into admonition blocks, whic…
Jan 1, 2026
59afce3
Splits Lists chapter into two.
Jan 1, 2026
a6681b5
Clarifies table semantics.
Jan 1, 2026
1ab6458
Renames docs/specification-proper-draft.md -> docs/specification.md
Jan 2, 2026
061a7f9
Refactory escapes semantics chapter 6 and splits it into 6 and 7
Jan 2, 2026
62f0f76
Improves \time and \datetime tz handling.
Jan 2, 2026
b853dfb
Implements automatic header number generation
Jan 2, 2026
89b2909
Improves the specification around 'fmt' attribute.
Jan 2, 2026
2984744
Removes rendering requirement for \footnote, removes resolved TODOs
Jan 2, 2026
f7e84ff
Adds note about inheritance of lang attribute
Jan 2, 2026
9467f1f
Clarifies tables more
Jan 2, 2026
ef62482
Add tasks from specification review
ikskuh Jan 2, 2026
57bf678
Merge pull request #8 from Ashet-Technologies/codex/derive-tasks-from…
ikskuh Jan 2, 2026
b5634df
Clarify top-level scope for chapter 9.2 elements
ikskuh Jan 2, 2026
ff19d99
Update chapter status for reorganized elements
ikskuh Jan 2, 2026
39c1563
Merge pull request #9 from Ashet-Technologies/codex/validate-internal…
ikskuh Jan 2, 2026
abc4070
Adds better introduction adding motivation, usage scenarios and desig…
Jan 2, 2026
27748e8
Add HTML5 document header test
ikskuh Jan 2, 2026
eb26031
Merge pull request #10 from Ashet-Technologies/codex/implement-title-…
ikskuh Jan 2, 2026
16a6af7
Cleans up specification text. Disallows arbitrary number of year digi…
Jan 2, 2026
effddce
Adds a huge load of stuff to docs/TODO.md, improves docs/specificatio…
Jan 2, 2026
893074e
Enforce top-level toc
ikskuh Jan 2, 2026
a4f1e51
Merge pull request #11 from Ashet-Technologies/codex/restrict-toc-to-…
ikskuh Jan 2, 2026
fb71acc
Track row title column usage
ikskuh Jan 3, 2026
52d16ef
Merge pull request #12 from Ashet-Technologies/codex/enforce-table-co…
ikskuh Jan 3, 2026
74d1dc0
Remove unused paragraph kind
ikskuh Jan 3, 2026
723d199
Merge pull request #13 from Ashet-Technologies/codex/modify-admonitio…
ikskuh Jan 3, 2026
21f6fc6
Guard plaintext rendering from unexpected refs
ikskuh Jan 3, 2026
f56cce7
Merge pull request #14 from Ashet-Technologies/codex/implement-inline…
ikskuh Jan 3, 2026
48997cd
Modify validate.yml for hdoc-2.0 and testing
ikskuh Jan 3, 2026
3627f99
Fixes simple merging bug
Jan 3, 2026
be0c069
Adds yaml dumps to tests. Adds basic golden file verification
Jan 3, 2026
dab3997
Implements proper snapshot test validation with a basic differ output…
Jan 3, 2026
ba41ef8
Add regression tests for pending footnotes
ikskuh Jan 3, 2026
3c68550
Fix pending footnote warning location
ikskuh Jan 3, 2026
9003d2e
Improves handling of missing files when dealing with snapshots
Jan 3, 2026
7a300d8
Merge pull request #15 from Ashet-Technologies/codex/add-footnote-han…
ikskuh Jan 3, 2026
bf902d0
Cleans SPEC_TODO.md
Jan 3, 2026
8ab0680
Adds specification parts about the syntax attribute.
Jan 3, 2026
38e93d6
Use CR escape in string_cr_escape reject fixture
ikskuh Jan 3, 2026
bde5027
Removes the hint about the now new specification.md file
Jan 3, 2026
67d4426
Clarify inline group brace text
ikskuh Jan 3, 2026
198d82b
Merge pull request #17 from Ashet-Technologies/codex/execute-trivial-…
ikskuh Jan 3, 2026
3a9ece8
Remove llvm requirement for hyperdoc exe
ikskuh Jan 3, 2026
b45e5c7
Merge pull request #18 from Ashet-Technologies/codex/fix-trivial-elem…
ikskuh Jan 3, 2026
4450419
Merge pull request #16 from Ashet-Technologies/codex/validate-hyperdo…
ikskuh Jan 3, 2026
53888e5
Pretty-print JSON diagnostics in snapshots
ikskuh Jan 4, 2026
5c22c76
Merge pull request #19 from Ashet-Technologies/codex/build-project-an…
ikskuh Jan 4, 2026
6f8fc99
Add conformance tests for document headers and images
ikskuh Jan 4, 2026
d61004c
Merge pull request #20 from Ashet-Technologies/codex/add-positive-and…
ikskuh Jan 4, 2026
27bd7c3
Simplify wasm buffers and logging
ikskuh Jan 4, 2026
b18866b
Merge pull request #21 from Ashet-Technologies/codex/implement-wasm-i…
ikskuh Jan 4, 2026
ccedc73
Gate WASM Node tests via build
ikskuh Jan 4, 2026
dcdcad6
Merge pull request #22 from Ashet-Technologies/codex/create-node.js-t…
ikskuh Jan 4, 2026
1dec714
Improves Wasm playground
Jan 4, 2026
aa26a71
Fixes playground for long text
Jan 4, 2026
5d43542
Improves example documents and playground
Jan 4, 2026
4535359
Adds pages rendering workflow
Jan 4, 2026
1668ff1
Add wasm LSP stub and extension CI workflow
ikskuh Jan 5, 2026
7a07e46
Use Node 20 for extension packaging workflow
ikskuh Jan 5, 2026
a4e2b0c
Point extension main to compiled output
ikskuh Jan 5, 2026
cc5e720
Add repository link and license for extension packaging
ikskuh Jan 5, 2026
7c5dc39
Merge pull request #23 from Ashet-Technologies/codex/create-hyperdoc-…
ikskuh Jan 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions .github/workflows/extension-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Extension CI

on:
pull_request:
branches: [master, hdoc-2.0]
push:
branches: [master, hdoc-2.0]

jobs:
build-and-package:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Zig
uses: mlugg/setup-zig@v2
with:
version: 0.15.2

- name: Build Zig artifacts
run: zig build install

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install extension dependencies
run: npm ci
working-directory: vscode-ext

- name: Copy wasm artifacts into extension bundle
run: |
mkdir -p vscode-ext/wasm
cp zig-out/www/hyperdoc_wasm.wasm vscode-ext/wasm/ || true
cp zig-out/www/hyperdoc_wasm_lsp.wasm vscode-ext/wasm/

- name: Build extension
run: npm run compile
working-directory: vscode-ext

- name: Test extension
run: npm test
working-directory: vscode-ext

- name: Package extension
run: |
npm run package
mv *.vsix hyperdoc-vscode.vsix
working-directory: vscode-ext

- name: Upload packaged extension
uses: actions/upload-artifact@v4
with:
name: hyperdoc-vscode.vsix
path: vscode-ext/hyperdoc-vscode.vsix

publish:
needs: build-and-package
if: github.event_name == 'push' && github.ref == 'refs/heads/hdoc-2.0'
runs-on: ubuntu-latest
environment:
name: vscode-marketplace
steps:
- name: Download packaged extension
uses: actions/download-artifact@v4
with:
name: hyperdoc-vscode.vsix
path: artifacts

- name: Publish to VS Code Marketplace
run: npx --yes vsce publish --packagePath artifacts/hyperdoc-vscode.vsix -p "$VSCE_PAT"
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
42 changes: 42 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Pages

on:
push:
branches: [hdoc-2.0]

jobs:
build:
runs-on: ubuntu-latest
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
environment:
name: github-pages
url: ${{steps.deployment.outputs.page_url}}
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Zig
uses: mlugg/setup-zig@v2
with:
version: 0.15.2

- name: Build
run: |
zig build install

- name: Test
run: |
zig build test

- name: Upload static files as artifact
id: pages-upload
uses: actions/upload-pages-artifact@v3
with:
path: zig-out/www

- name: Deploy artifact
id: deployment
uses: actions/deploy-pages@v4
12 changes: 8 additions & 4 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Build

on:
pull_request:
branches: [master]
branches: [master, hdoc-2.0]
push:
branches: [master]
branches: [master, hdoc-2.0]

jobs:
build:
Expand All @@ -16,8 +16,12 @@ jobs:
- name: Setup Zig
uses: mlugg/setup-zig@v2
with:
version: 0.15.1
version: 0.15.2

- name: Build
run: |
zig build
zig build install

- name: Test
run: |
zig build test
30 changes: 30 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# AGENTS

## General guidelines

- Keep changes focused and incremental; prefer small, reviewable commits.
- Follow existing code style and formatting conventions.
- Use `zig fmt` on Zig source files after edits.
- Ensure new tests are added or updated when behavior changes.
- Run relevant tests (`zig build test`) when making code changes.
- Run `zig build` to validate the main application still compiles
- Test `./zig-out/bin/hyperdoc` with the `.hdoc` files in `examples/` and `test/`.
- Avoid editing documentation unless the request explicitly asks for it.
- `src/hyperdoc.zig` must not contain locale- or rendering-specific parts.
- Treat `docs/specification.md` as the authoritative source of behavior; examples may be outdated or incorrect.
- If the spec is unclear or conflicts with code/tests, ask before changing behavior.
- Do not implement "just make it work" fallbacks that alter semantics to satisfy examples.
- Diagnostics must not store dynamic strings (e.g., slices to parsed source). Keep diagnostic payloads POD/small and avoid holding arena-backed text.
- Do not hide crashes by removing safety checks or switching off DebugAllocator; fix the root cause instead. A signal 6 from DebugAllocator indicates memory corruption or a similar misuse.

## Zig Programming Style

- Do not use "inline functions" like `const func = struct { fn func(…) {} }.func;`
- Zig has no methods. Functions used by "method like" functions can still be placed next to them, no need to put them into global scope nor into local scope.

## Snapshot Files

- If you add a `hdoc` file to `test/snapshot`, also:
- Generate the corresponding html and yaml file
- Add the file inside build.zig to the snapshot_files global
- If you change behaviour, the snapshot tests will fail. Validate the failure against your expectations and see if you broke something unexpected.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 HyperDoc Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
89 changes: 30 additions & 59 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,62 +1,33 @@
# Ashet HyperDocument Format

This format is used for both the _Hyper Wiki_ as well as the _Gateway_ application to store and display
hyperlinked documents.

The format is a rich-text format that can encode/store/display the following document blocks:

- paragraphs (consisting of a sequence of spans)
- regular text
- links
- bold/emphasised text
- monospaced text
- line break
- 3 levels of headings
- ordered and unordered lists
- each list item is a paragraph or another list
- quotes (paragraph with special styling)
- preformatted text (code blocks, also uses the paragraph formatting)
- images

Regular text is assumed to use a proportional font, while preformatted text is required to be rendered as monospace.

## Storage

HyperDocument is stored as a trivial-to-parse plain text format, not necessarily meant to be edited by humans,
but still human readable.

**Example:**

```lua
hdoc "1.0"
p {
span "Hello, World!\n"
link "http://google.com" "Visit Google!"
span "\n"
emph "This is fat!"
span "\n"
mono "int main()"
span "\n"
}
enumerate {
item { p { span "first" } }
item { p { span "second" } }
item { p { span "third" } }
}
itemize {
item { p { span "first" } }
item { p { span "second" } }
item { p { span "third" } }
}
quote {
span "Life is what happens when you're busy making other plans.\n - John Lennon"
}
pre {
span "const std = @import(\"std\");\n"
span "\n"
span "pub fn main() !void {\n"
span " std.debug.print(\"Hello, World!\\n\", .{});\n"
span "}\n"
}
image "dog.png"
## Motivation

> TODO: Write motivation

## Specification

[Read the specification](docs/specification.md).

## Building

Requires [Zig 0.15.2](https://ziglang.org/) installed.

### Build debug application

```sh-session
[user@host] hyperdoc$ zig build
```

### Build release application

```sh-session
[user@host] hyperdoc$ zig build -Drelease
```

### Run test suite

```sh-session
[user@host] hyperdoc$ zig build test
```

> Optional: installing Node.js enables the WASM integration tests that exercise the compiled `hyperdoc_wasm.wasm` via `node test/wasm/validate.js`.
6 changes: 6 additions & 0 deletions SPEC_TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Spec compliance TODOs

- Title/header interplay lacks the required comparison.
- Expect: When both `hdoc(title=...)` and `title { ... }` are present, their plaintext forms are compared and a redundancy hint is emitted if they match (§8.1).
- Actual: The block title is used and the header title is ignored without any comparison or diagnostics.
- Proposed: Compare the plaintext values, warn when redundant, and keep emitting hints when neither title form is present.
Loading
Loading