--- 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 .
Return early on error. Keep state immutable.
Deeply nest conditionals. Mutate shared globals.
Sends JSON
Validates schema
Draft spec
Run tests
Tag release
One line
First line Second line
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]].
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 `v0.2: Added slide mode, Removed legacy flag.
Enable fast O(n) scanning and drop slow path.
Added fn() { return 1 } helper
{+: 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} +-- .Press Ctrl+K to run: 80%
- [!] [[Ctrl+C]] {+: raw} [=====.....] 50%
````````````````````````````````
Inline code spans never parse ACC syntax:
```````````````````````````````` example
Code: `[[Ctrl]]`, `{+: add}`, `[====....] 60%`.
.
Code: [[Ctrl]], {+: add}, [====....] 60%.
Single column box.