--- title: Hue Markdown v0.2 Acceptance Criteria & Spec (ACC) version: 0.2.0-acc date: 2026-11-16 status: Promoted to production in Hue MD v0.2.0 (src/). The v0.2 syntax and examples are now in spec/spec.md; this file stays as the record of the acceptance gates. --- # Hue Markdown v0.2 Acceptance Criteria (ACC) This document defines the Acceptance Criteria (ACC), grammar rules, target outputs (HTML, CSS, GitHub Flavored Markdown downgrade, and 24-bit ANSI terminal output), and executable test examples for the six Hue Markdown v0.2 features (ACC-1 to ACC-6), plus their composed interactions, before promoting any changes to production (`src/` and editor packages). ## Promotion Gate Checklist (ACC -> PRD) 1. **PRD Isolation**: Zero production files in `src/`, `packages/md-hue/src/`, `packages/vscode-hue/`, or `scripts/render-demo.js` / `scripts/playground-entry.js` are modified during ACC validation. 2. **CommonMark 0.31.2 Superset Gate**: All 652 CommonMark 0.31.2 specification examples render byte-for-byte identically with `hueNext` enabled. 3. **v0.1 Backward Compatibility Gate**: All 58 Hue MD v0.1 specification examples in `spec/spec.md` render identically with `hueNext` enabled. 4. **Executable ACC Spec Gate**: All 30 executable specification examples in this document pass automated verification. 5. **Corpus Safety Gate**: Zero unintended false positives for key caps (`[[...]]`), progress bars (`[===...] NN%`), diff spans (`{+: ...}`, `{-: ...}`), and split boxes across the 200 npm READMEs and 50 LLM responses in `corpus/`. The corpus is not committed (`corpus/` is in `.gitignore`), so this gate runs locally only: run `node scripts/fetch-corpus.js` once, then `npm test`. Without `corpus/`, as in GitHub Actions, the test is reported as skipped. 6. **Pathological Performance Gate**: 20,000 adversarial unclosed tokens (`[[`, `[===`, `{+:`, `{-:`, and 5,000 split box header rows) grow linearly: 4 times the input (5,000 to 20,000 tokens, best of 3 runs) costs less than 10 times the time, and 20,000 tokens render in under 2 seconds. Linear code takes about 4 times as long (measured 3.4 to 5.2 times); quadratic code, the risk this gate guards against, about 16 times. The gate measures growth instead of a fixed number of milliseconds because a fixed 200 ms budget failed at random on slower CI runners. 7. **Downgrade Completeness Gate**: Every ACC construct downgrades cleanly to valid GitHub Flavored Markdown with zero surviving Hue syntax. 8. **Terminal ANSI Gate**: Every ACC construct renders to 24-bit ANSI truecolor without exceeding target line width or leaking SGR escape codes across lines. --- ## ACC-1: Multi-State Tasks & Status Ticks ### Grammar Inside a bullet or ordered list item, when the first inline text starts with `[marker]` followed by at least one whitespace character (`^\[([ xX\-!?])\]\s+`) and is not a resolved CommonMark reference link: | Marker | State Name | Palette Color | HTML Symbol | GFM Downgrade | ANSI Marker | | :--- | :--- | :--- | :--- | :--- | :--- | | `[ ]` | `todo` | `gray` | `☐` (`☐`) | `- [ ] ...` | `[☐]` (gray) | | `[-]` | `progress` | `blue` | `◐` (`◐`) | `- [ ] *(in progress)* ...` | `[◐]` (blue) | | `[!]` | `blocked` | `red` | `!` | `- [ ] **[!]** ...` | `[!]` (red) | | `[?]` | `question` | `purple` | `?` | `- [ ] **[?]** ...` | `[?]` (purple) | | `[x]` / `[X]` | `done` | `green` | `✓` (`✔`) | `- [x] ...` | `[✔]` (green) | ### Examples ```````````````````````````````` example - [ ] Write parser tests - [-] Implement split boxes - [!] Fix regression bug - [?] Confirm keycap list - [x] Ship ACC suite . ```````````````````````````````` Uppercase `[X]` maps to the `done` state: ```````````````````````````````` example 1. [X] First milestone .
  1. First milestone
```````````````````````````````` Inline formatting and Hue spans work inside task items: ```````````````````````````````` example - [!] Resolve {red: critical} **build** error . ```````````````````````````````` Unknown marker characters or missing trailing spaces stay literal text: ```````````````````````````````` example - [a] Not a task state - [x]No space after bracket . ```````````````````````````````` A defined CommonMark shortcut reference link `[x]` takes precedence over task markers: ```````````````````````````````` example - [x] linked item [x]: /done . ```````````````````````````````` --- ## ACC-2: Side-by-Side Split Box Columns ### Grammar Two or more Hue boxes placed on the same lines and separated by at least two spaces (` `) form a multi-column box group (`
`): 1. **Top row**: Every column must start with a valid Hue box top border (`+--`, `┌─`, `╭─`) preceded by at least two spaces after the previous column. 2. **Interior rows**: Each column slice `[col_k, col_{k+1})` must start with a side border (`|` or `│`), a bottom border (`+--`, `└──`, `╰──`), or blank padding after that column's bottom border. 3. **Bottom closure**: All columns must close with a valid bottom border. If any column is unclosed or invalid, the block falls back without matching. ### Examples Two open ASCII boxes side by side: ```````````````````````````````` example +-- ok Good practice +-- warn Bad practice | Return early on error. | Deeply nest conditionals. | Keep state immutable. | Mutate shared globals. +-- +-- .
Good practice

Return early on error. Keep state immutable.

Bad practice

Deeply nest conditionals. Mutate shared globals.

```````````````````````````````` Closed Unicode boxes side by side: ```````````````````````````````` example ┌─ blue Client ─────┐ ┌─ purple Server ───┐ │ Sends **JSON** │ │ Validates schema │ └───────────────────┘ └───────────────────┘ .
Client

Sends JSON

Server

Validates schema

```````````````````````````````` Three columns side by side: ```````````````````````````````` example +-- info Plan +-- warn Build +-- ok Ship | Draft spec | Run tests | Tag release +-- +-- +-- .
Plan

Draft spec

Build

Run tests

Ship

Tag release

```````````````````````````````` Columns of unequal height (one column closes earlier than the other): ```````````````````````````````` example +-- ok Short +-- info Longer | One line | First line +-- | Second line +-- .
Short

One line

Longer

First line Second line

```````````````````````````````` --- ## ACC-3: Native Key Caps (`[[Key]]`) ### Grammar `[[Key]]` renders as `Key` when `Key` is a recognized keyboard token or chord: 1. **Named keys** (case-insensitive): `Ctrl`, `Control`, `Shift`, `Alt`, `Option`, `Opt`, `Cmd`, `Command`, `Super`, `Meta`, `Win`, `Fn`, `Enter`, `Return`, `Esc`, `Escape`, `Tab`, `Space`, `Spacebar`, `Backspace`, `Bksp`, `Delete`, `Del`, `Insert`, `Ins`, `Up`, `Down`, `Left`, `Right`, `Home`, `End`, `PgUp`, `PageUp`, `PgDn`, `PageDown`, `CapsLock`, `Caps`, `NumLock`, `ScrollLock`, `PrtSc`, `PrintScreen`, `Pause`, `Break`, `Menu`, `Clear`, `F1`–`F24`. 2. **Single uppercase letter or key symbol**: `A`–`Z`, `/`, `?`, `+`, `-`, `=`, `~`, `⌘`, `⌥`, `⇧`, `⌃`, `⏎`, `⌫`, `⇥`, `⎋`, `↑`, `↓`, `←`, `→`. 3. **Key chords** joined by `+`: e.g., `[[Ctrl+C]]`, `[[Cmd+Shift+P]]`, `[[Alt+F4]]`, `[[Ctrl+1]]`, `[[Ctrl++]]`. 4. **False-positive guards**: - WikiLinks with spaces or multi-letter unknown words (`[[Project Roadmap]]`, `[[foobar]]`) stay literal text. - Lowercase single letters or digits (`[[a]]`, `[[0]]`, `[[1]]`) and indexed expressions (`arr[[0]]`) stay literal text. ### Examples Individual keys separated by text: ```````````````````````````````` example Press [[Ctrl]] + [[Shift]] + [[P]] to open the palette. .

Press Ctrl + Shift + P to open the palette.

```````````````````````````````` Combined chord inside a single keycap: ```````````````````````````````` example Use [[Cmd+Shift+P]] or [[Alt+F4]] or [[Ctrl++]]. .

Use Cmd+Shift+P or Alt+F4 or Ctrl++.

```````````````````````````````` Navigation, function, and symbol keys: ```````````````````````````````` example Hit [[Esc]], [[Enter]], [[Tab]], [[F5]], or [[?]]. .

Hit Esc, Enter, Tab, F5, or ?.

```````````````````````````````` WikiLinks and unknown words are never touched: ```````````````````````````````` example See [[Project Roadmap]] and [[internal_doc]] for details. .

See [[Project Roadmap]] and [[internal_doc]] for details.

```````````````````````````````` Array indexing and lowercase/digit tokens stay untouched: ```````````````````````````````` example Matrix value `a[[0]]` or [[0]] or [[a]] or [[1, 2]]. .

Matrix value a[[0]] or [[0]] or [[a]] or [[1, 2]].

```````````````````````````````` Backslash-escaped keycaps stay literal: ```````````````````````````````` example Literal \[[Ctrl]] keycap. .

Literal [[Ctrl]] keycap.

```````````````````````````````` --- ## ACC-4: Text Progress & Metric Bars ### Grammar `[fill+empty] NN%` renders as an accessible progress bar (`role="progressbar"`): 1. **Bar characters**: `4` to `40` total characters inside `[...]`, consisting of `0..40` filled characters (`=`, `#`, `■`, `█`) followed by `0..40` empty characters (`.`, `-`, `_`, `░`, ` `), with at least one non-space character. 2. **Percentage**: Followed by optional whitespace and an integer `0`–`100` with `%`. 3. **Color thresholds**: - `100%` -> `green` (`hue-progress-green`) - `50%`–`99%` -> `blue` (`hue-progress-blue`) - `25%`–`49%` -> `orange` (`hue-progress-orange`) - `0%`–`24%` -> `red` (`hue-progress-red`) ### Examples All four automatic color tiers: ```````````````````````````````` example Done: [==========] 100% Active: [======....] 60% Warmup: [===.......] 30% Low: [=.........] 10% .

Done: 100% Active: 60% Warmup: 30% Low: 10%

```````````````````````````````` Zero percent progress bar: ```````````````````````````````` example Queued: [..........] 0% .

Queued: 0%

```````````````````````````````` Hash and Unicode block characters also work: ```````````````````````````````` example Build: [####----] 50% .

Build: 50%

```````````````````````````````` Brackets without a trailing percentage or shorter than 4 bar chars stay literal: ```````````````````````````````` example Not a bar: [====] and [==] 50% and [====] 150%. .

Not a bar: [====] and [==] 50% and [====] 150%.

```````````````````````````````` --- ## ACC-5: Inline Diff / Change Spans (`{+: ...}`, `{-: ...}`) ### Grammar - `{+: content}` renders as `content`. - `{-: content}` renders as `content`. - Follows all Hue span rules: linear brace matching, inner Markdown parsing, code span protection, and backslash escaping. ### Examples Basic inline addition and deletion: ```````````````````````````````` example v0.2: {+: Added slide mode}, {-: Removed legacy flag}. .

v0.2: Added slide mode, Removed legacy flag.

```````````````````````````````` Nested Markdown and Hue spans inside diff spans: ```````````````````````````````` example {+: Enable **fast** `O(n)` scanning} and {-: drop *slow* path}. .

Enable fast O(n) scanning and drop slow path.

```````````````````````````````` Braces inside code spans do not close a diff span: ```````````````````````````````` example {+: Added `fn() { return 1 }` helper} .

Added fn() { return 1 } helper

```````````````````````````````` Escaped or empty diff spans stay literal text: ```````````````````````````````` example \{+: literal} and {+:} and {-: unclosed .

{+: literal} and {+:} and {-: unclosed

```````````````````````````````` --- ## ACC-6: Terminal Slide Deck Mode ### Grammar `parseSlides(src)` splits a `.hue.md` document into slides; `renderSlides(src, options)` renders them as framed 24-bit ANSI terminal slides. Slides produce terminal output, not HTML, so this section has no executable HTML examples. The unit test `ACC-6: parseSlides splits on top-level ---…` in `test/acc.test.js` verifies the criteria below. 1. **Slide separator**: a line of three or more `-` (up to three spaces of indent) that is preceded by a blank line, a heading, or a box bottom border. A `---` directly under a paragraph line stays a setext heading underline. 2. **Protected regions**: `---` inside fenced code blocks (`` ``` `` or `~~~`) and inside Hue boxes never splits a slide. 3. **Titles**: each slide's title is its first `#`, `##`, or `###` heading, or `Slide N` when it has none. 4. **Frame**: every rendered line is exactly the requested `width` columns wide, and each slide shows a `[ N / total ]` footer. 5. **Single slide**: `renderSlides(src, { slide: N })` renders only slide `N`. Example deck (three slides; the `---` inside the fence and the box do not split): ```markdown # Intro Slide Welcome to Hue. --- # Code & Box Slide ~~~yaml --- key: value ~~~ +-- info Note | --- +-- --- # Final Slide - [x] Done ``` --- ## Composed Features & Interactions All ACC features compose inside boxes, split boxes, lists, and tables: ```````````````````````````````` example +-- info Keyboard & Progress | Press [[Ctrl+K]] to run: | [========..] 80% | - [x] {+: Ready} +-- .
Keyboard & Progress

Press Ctrl+K to run: 80%

```````````````````````````````` ````hue` fenced blocks render all ACC features: ```````````````````````````````` example ```hue - [-] {+: Deploying} with [[Ctrl+Enter]] ``` . ```````````````````````````````` Other code fences never parse ACC syntax: ```````````````````````````````` example ```txt - [!] [[Ctrl+C]] {+: raw} [=====.....] 50% ``` .
- [!] [[Ctrl+C]] {+: raw} [=====.....] 50%
```````````````````````````````` Inline code spans never parse ACC syntax: ```````````````````````````````` example Code: `[[Ctrl]]`, `{+: add}`, `[====....] 60%`. .

Code: [[Ctrl]], {+: add}, [====....] 60%.

```````````````````````````````` Keycaps and diff spans work inside link text: ```````````````````````````````` example [Press [[Enter]] to {+: continue}](/start) .

Press Enter to continue

```````````````````````````````` Split boxes containing tasks and diff spans: ```````````````````````````````` example +-- ! Before +-- ok After | - [!] {-: Slow regex} | - [x] {+: Linear scan} +-- +-- .
Before
  • Slow regex
After
  • Linear scan
```````````````````````````````` Single box with spaces in its title is never mistaken for split columns: ```````````````````````````````` example +-- info Release Notes | Single column box. +-- .
Release Notes

Single column box.

````````````````````````````````