vantage-md 0.5.8 → 0.5.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1037,6 +1037,9 @@ declare const rehypeSourceLines: Plugin<[RehypeSourceLinesOptions?], Root>;
1037
1037
  //#region src/rehypeVantageDirectives.d.ts
1038
1038
  declare const rehypeVantageDirectives: Plugin<[], Root>;
1039
1039
  //#endregion
1040
+ //#region src/rehypeVantageAnchors.d.ts
1041
+ declare function rehypeVantageAnchors(): (tree: Root) => void;
1042
+ //#endregion
1040
1043
  //#region src/vantageDirectives.d.ts
1041
1044
  /**
1042
1045
  * The directive grammar and the closed vocabulary — one parser, no renderer.
@@ -1513,7 +1516,7 @@ declare function resolveLinks(html: string, options?: ResolveLinkOptions): strin
1513
1516
  * Every rule stated here should be one a checker can enforce or a renderer
1514
1517
  * actually cares about — if a line is neither, it does not belong.
1515
1518
  */
1516
- declare const STYLE_GUIDE = "## Markdown style guide (for Vantage viewer)\n\nWhen writing or updating markdown documents that will be viewed in Vantage, follow these conventions:\n\n### Structure\n- Use headings (## and ###) to organize content — they become navigable outline anchors.\n- Keep paragraphs focused and concise. Break up dense text with subheadings, lists, or tables.\n\n### Links and cross-references\n- **Relative paths only**: Always link relative to the *current file's directory*:\n - Sibling in same folder: `[Other Doc](./other-doc.md)` or `[Other Doc](other-doc.md)`\n - Subdirectory: `[Design Doc](./design/auth.md)`\n - Parent / sibling folder: `[Overview](../overview.md)` or `[Spec](../specs/api.md)`\n- **Never use leading slashes**:\n - ❌ `[Doc](/docs/guide.md)` (breaks web routing and multi-repo scoping)\n - ✅ `[Doc](../docs/guide.md)` or `[Doc](./guide.md)`\n- **Never use absolute filesystem paths or URI schemes**:\n - ❌ `file:///workspace/docs/guide.md`, `/workspace/docs/guide.md`, `C:\\...`\n - ✅ `[Doc](./guide.md)` or `[Doc](../guide.md)`\n- **Always include the file extension**: Use `.md`, `.ts`, `.go`, etc. (e.g. `[Model](model.go)`).\n- **Line anchors and ranges**:\n - Link to specific lines: `[Handler](../server/api.go#L42)` or `[Range](../server/api.go#L42-L58)`\n - Same-file line anchor: `[See lines](#L10-L25)`\n - Vantage scrolls to and highlights the target lines.\n- **Section anchors**:\n - Same doc: `[Usage](#usage)`\n - Cross-doc: `[Architecture](../overview.md#system-architecture)`\n - Anchor slugs are lowercase, hyphenated, and punctuation-stripped.\n- **Backticks in links**: Place backticks inside the link label, not around the markdown link syntax:\n - ✅ `[`config.json`](./config.json)` or `[config.json](./config.json)`\n - ❌ ``[config.json](./config.json)``\n\n### Frontmatter (Metadata)\n- Include structured metadata at the very top of docs delimited by `---` (YAML) or `+++` (TOML). Vantage renders this as a metadata card:\n```yaml\n---\ntitle: \"Feature Specification\"\nauthor: \"Agent\"\ndate: 2026-08-15\nstatus: in-review # draft | in-review | accepted | deprecated\ntags: [architecture, backend, api]\nsummary: \"Brief description of the document purpose.\"\nvantage:\n status-chip: true # show `status` as a chip above the metadata card\n---\n```\n- **Nothing may sit above the opening delimiter** — not a blank line, not an editorial comment, not a `<!-- vantage: … -->` directive. Frontmatter is recognised only at the very first byte of the file (in Vantage, on GitHub, and in every other reader), so one line above it turns the whole block into body text: a horizontal rule followed by a heading made of the raw keys, with every field lost. `vantage-check` reports it as `frontmatter/not-at-top`.\n- **`vantage:` is Vantage's own reserved key.** It holds chrome that belongs to the file rather than to a section, it never shows up in the metadata card, and every other renderer ignores it. One key today: `status-chip`.\n- **Prefer `status-chip: true`**, which shows the document's own `status:` and therefore cannot disagree with it. A literal `status-chip: accepted` is accepted too, but it is a second value that goes stale on its own — `vantage-check` reports the disagreement.\n- The chip's vocabulary is `status`'s, exactly: `draft | in-review | accepted | deprecated`, lowercase. `Draft` renders no chip at all, silently.\n\n### Mermaid diagrams\n- Use ```mermaid code blocks for flowcharts, sequence diagrams, and architecture diagrams. Vantage provides interactive zoom, pan, dark/light theme adaptation, and SVG export.\n- **Quote labels with special characters**: Always quote node labels containing parentheses, brackets, or colons to prevent syntax errors:\n```mermaid\nflowchart TD\n client[\"Client (React SPA)\"] -->|WebSocket| srv[\"Vantage Server (Go)\"]\n srv --> git[\"Git CLI (git diff)\"]\n```\n\n### Code blocks and diffs\n- Always tag fenced code blocks with language identifiers (`ts`, `go`, `python`, `bash`, `json`, `yaml`, `diff`, `sql`, etc.) for syntax highlighting.\n- For proposed code modifications, use ```diff blocks with `+` and `-` prefixes:\n```diff\n-const oldUrl = \"/api/v1\";\n+const newUrl = \"/api/v2\";\n```\n\n### Callouts and alerts\n- Use GitHub-style blockquote callouts for notes, tips, and warnings:\n> [!NOTE]\n> Background context or helpful explanation.\n\n> [!TIP]\n> Best practice advice or optimization suggestions.\n\n> [!IMPORTANT]\n> Key requirements or crucial information.\n\n> [!WARNING]\n> Urgent caution, breaking changes, or potential pitfalls.\n\n> [!CAUTION]\n> High-risk actions that could cause data loss or security issues.\n\n### Vantage directives (optional, and Vantage-only)\n\nVantage reads a few styling hints from ordinary HTML comments. Every other renderer — GitHub included — drops them, so a document has to read exactly the same without them: directives decorate, they never carry meaning. One goes on a line of its own, with a blank line after it, and applies to the block that follows:\n\n```markdown\n<!-- vantage: section tone=warning badge=stale -->\n\n## Migration path\n\nThe steps below predate the rewrite.\n```\n\n- **Three names**: `section` (the heading and everything under it), `block` (the one block after it), `oq` (one answerable Open Question).\n- **The keys and values are a closed set**: `tone` = `note | tip | important | warning | caution | muted`; `emphasis` = `strong | normal | quiet`; `badge` = `draft | stale | blocked | done | wip`; `collapsed` = `true | false`. Name a *tone*, never a colour — the theme decides what a warning looks like, in light mode, in dark mode, and in print.\n- **Use them sparingly.** One or two per document, on the sections that genuinely differ. A document where everything is toned says nothing, and a rainbow one is harder to read than a plain one.\n- **Anything outside those sets is silently ignored** — nothing breaks, and nothing styles either. Run `vantage-check` on the document: the `vantage/*` rules are the only thing that will ever tell you a directive did nothing.\n- **Always close the comment with `-->`.** Never `--!>`, and never leave it open: Markdown reads every line below an unclosed `<!--` as part of the comment, and the whole rest of the document vanishes from the page. For the same reason `-->` cannot appear *inside* a value — it ends the comment early and spills the remainder into the page as literal text.\n- **In a list, indent the directive inside the item**, with blank lines around it (below). At the start of a line between two items it ends the list and starts a second one, which changes the numbering and the spacing in every renderer — the one thing a directive must never do.\n- **Every open question (💬) with a stated leaning gets an `oq` directive.** The convention's prose — the emoji, the `OQ-N` id, the `_Leaning:_` line, the fill-in `**Answer:**` — produces no button on its own. Writing the convention and stopping there is the most common way this feature goes missing: the questions look complete, review mode is on, and there is nothing to click. **`vantage-check` reports it as an error** (`vantage/oq-missing`), because a question awaiting a ruling that the reviewer cannot file is not a style preference. Mark it 🔒 if it is blocked on something upstream and cannot be answered yet, or ✅ once it is decided; either state needs no directive.\n- **A `leaning` restates the leaning; it is never \"yes\".** The one-click button in review mode files that text as a review comment, and the comment is all the agent reading it has — nobody remembers which button was clicked. `leaning=\"Yes\"` beside a two-branch question is a support ticket.\n\n```markdown\n1. **OQ-9: Queue position on re-entry.**\n\n <!-- vantage: oq id=OQ-9 leaning=\"Back of the queue — the fix might interact with what merged while it was out.\" -->\n\n _Leaning:_ Back of the queue.\n```\n\n### Tables, task lists, and math\n- **Tables**: Use standard markdown tables for structured comparisons and schemas.\n- **Task lists**: Use `- [ ]` and `- [x]` for actionable checklists and status tracking.\n- **LaTeX Math**: Use `$$...$$` for *all* KaTeX math — display blocks (`$$` alone on its own lines) and inline alike (`$$E = mc^2$$` mid-sentence).\n - Single dollars are **not** math delimiters: `$HOME` and `$100` stay literal, so prose and shell snippets are safe to write as-is.\n";
1519
+ declare const STYLE_GUIDE = "## Markdown style guide (for Vantage viewer)\n\nWhen writing or updating markdown documents that will be viewed in Vantage, follow these conventions:\n\n### Structure\n- Use headings (## and ###) to organize content — they become navigable outline anchors.\n- Keep paragraphs focused and concise. Break up dense text with subheadings, lists, or tables.\n\n### Links and cross-references\n- **Relative paths only**: Always link relative to the *current file's directory*:\n - Sibling in same folder: `[Other Doc](./other-doc.md)` or `[Other Doc](other-doc.md)`\n - Subdirectory: `[Design Doc](./design/auth.md)`\n - Parent / sibling folder: `[Overview](../overview.md)` or `[Spec](../specs/api.md)`\n- **Never use leading slashes**:\n - ❌ `[Doc](/docs/guide.md)` (breaks web routing and multi-repo scoping)\n - ✅ `[Doc](../docs/guide.md)` or `[Doc](./guide.md)`\n- **Never use absolute filesystem paths or URI schemes**:\n - ❌ `file:///workspace/docs/guide.md`, `/workspace/docs/guide.md`, `C:\\...`\n - ✅ `[Doc](./guide.md)` or `[Doc](../guide.md)`\n- **Always include the file extension**: Use `.md`, `.ts`, `.go`, etc. (e.g. `[Model](model.go)`).\n- **Line anchors and ranges**:\n - Link to specific lines: `[Handler](../server/api.go#L42)` or `[Range](../server/api.go#L42-L58)`\n - Same-file line anchor: `[See lines](#L10-L25)`\n - Vantage scrolls to and highlights the target lines.\n- **Section anchors**:\n - Same doc: `[Usage](#usage)`\n - Cross-doc: `[Architecture](../overview.md#system-architecture)`\n - Anchor slugs are lowercase, hyphenated, and punctuation-stripped.\n- **Backticks in links**: Place backticks inside the link label, not around the markdown link syntax:\n - ✅ `[`config.json`](./config.json)` or `[config.json](./config.json)`\n - ❌ ``[config.json](./config.json)``\n\n### Frontmatter (Metadata)\n- Include structured metadata at the very top of docs delimited by `---` (YAML) or `+++` (TOML). Vantage renders this as a metadata card:\n```yaml\n---\ntitle: \"Feature Specification\"\nauthor: \"Agent\"\ndate: 2026-08-15\nstatus: in-review # draft | in-review | accepted | deprecated\ntags: [architecture, backend, api]\nsummary: \"Brief description of the document purpose.\"\nvantage:\n status-chip: true # show `status` as a chip above the metadata card\n---\n```\n- **Nothing may sit above the opening delimiter** — not a blank line, not an editorial comment, not a `<!-- vantage: … -->` directive. Frontmatter is recognised only at the very first byte of the file (in Vantage, on GitHub, and in every other reader), so one line above it turns the whole block into body text: a horizontal rule followed by a heading made of the raw keys, with every field lost. `vantage-check` reports it as `frontmatter/not-at-top`.\n- **`vantage:` is Vantage's own reserved key.** It holds chrome that belongs to the file rather than to a section, it never shows up in the metadata card, and every other renderer ignores it. One key today: `status-chip`.\n- **Prefer `status-chip: true`**, which shows the document's own `status:` and therefore cannot disagree with it. A literal `status-chip: accepted` is accepted too, but it is a second value that goes stale on its own — `vantage-check` reports the disagreement.\n- The chip's vocabulary is `status`'s, exactly: `draft | in-review | accepted | deprecated`, lowercase. `Draft` renders no chip at all, silently.\n\n### Mermaid diagrams\n- Use ```mermaid code blocks for flowcharts, sequence diagrams, and architecture diagrams. Vantage provides interactive zoom, pan, dark/light theme adaptation, and SVG export.\n- **Quote labels with special characters**: Always quote node labels containing parentheses, brackets, or colons to prevent syntax errors:\n```mermaid\nflowchart TD\n client[\"Client (React SPA)\"] -->|WebSocket| srv[\"Vantage Server (Go)\"]\n srv --> git[\"Git CLI (git diff)\"]\n```\n\n### Code blocks and diffs\n- Always tag fenced code blocks with language identifiers (`ts`, `go`, `python`, `bash`, `json`, `yaml`, `diff`, `sql`, etc.) for syntax highlighting.\n- For proposed code modifications, use ```diff blocks with `+` and `-` prefixes:\n```diff\n-const oldUrl = \"/api/v1\";\n+const newUrl = \"/api/v2\";\n```\n\n### Callouts and alerts\n- Use GitHub-style blockquote callouts for notes, tips, and warnings:\n> [!NOTE]\n> Background context or helpful explanation.\n\n> [!TIP]\n> Best practice advice or optimization suggestions.\n\n> [!IMPORTANT]\n> Key requirements or crucial information.\n\n> [!WARNING]\n> Urgent caution, breaking changes, or potential pitfalls.\n\n> [!CAUTION]\n> High-risk actions that could cause data loss or security issues.\n\n### Vantage directives (optional, and Vantage-only)\n\nVantage reads a few styling hints from ordinary HTML comments. Every other renderer — GitHub included — drops them, so a document has to read exactly the same without them: directives decorate, they never carry meaning. One goes on a line of its own, with a blank line after it, and applies to the block that follows:\n\n```markdown\n<!-- vantage: section tone=warning badge=stale -->\n\n## Migration path\n\nThe steps below predate the rewrite.\n```\n\n- **Three names**: `section` (the heading and everything under it), `block` (the one block after it), `oq` (one answerable Open Question).\n- **The keys and values are a closed set**: `tone` = `note | tip | important | warning | caution | muted`; `emphasis` = `strong | normal | quiet`; `badge` = `draft | stale | blocked | done | wip`; `collapsed` = `true | false`. Name a *tone*, never a colour — the theme decides what a warning looks like, in light mode, in dark mode, and in print.\n- **Use them sparingly.** One or two per document, on the sections that genuinely differ. A document where everything is toned says nothing, and a rainbow one is harder to read than a plain one.\n- **Anything outside those sets is silently ignored** — nothing breaks, and nothing styles either. Run `vantage-check` on the document: the `vantage/*` rules are the only thing that will ever tell you a directive did nothing.\n- **Always close the comment with `-->`.** Never `--!>`, and never leave it open: Markdown reads every line below an unclosed `<!--` as part of the comment, and the whole rest of the document vanishes from the page. For the same reason `-->` cannot appear *inside* a value — it ends the comment early and spills the remainder into the page as literal text.\n- **In a list, indent the directive inside the item**, with blank lines around it (below). At the start of a line between two items it ends the list and starts a second one, which changes the numbering and the spacing in every renderer — the one thing a directive must never do.\n- **An open question's id is `OQ-` then an optional short uppercase prefix then digits** — `OQ-9`, `OQ-TP6`, `OQ-A03`. The prefix is what keeps ids distinct once one document references another's questions, so use one in both whenever they cross-reference. `vantage-check` reports anything outside that shape as `vantage/oq-id-format`, and the same id twice in one document as `vantage/oq-id-duplicate` — both are silent otherwise, because the id becomes the block's anchor and a refused or duplicated one simply goes nowhere.\n- **A reference is a link, or it is a lie.** An `OQ-` id, a `§N` section number and a filename all read like pointers, and written as bare prose none of them can be followed or checked — which is exactly why a stale one is never caught. Link the question to its anchor (`[OQ-4](#OQ-4)`, or the Decision Ledger once it is compacted), the section to its heading, the filename to the file. `vantage-check` reports all three (`ref/*`) as errors, and checks that the link points at the thing the reference names rather than merely at something. Writing a specimen rather than a reference? Put it in a fenced block, which the rules never read.\n- **Every open question (💬) with a stated leaning gets an `oq` directive.** The convention's prose — the emoji, the `OQ-N` id, the `_Leaning:_` line, the fill-in `**Answer:**` — produces no button on its own. Writing the convention and stopping there is the most common way this feature goes missing: the questions look complete, review mode is on, and there is nothing to click. **`vantage-check` reports it as an error** (`vantage/oq-missing`), because a question awaiting a ruling that the reviewer cannot file is not a style preference. Mark it 🔒 if it is blocked on something upstream and cannot be answered yet, or ✅ once it is decided; either state needs no directive.\n- **A `leaning` restates the leaning; it is never \"yes\".** The one-click button in review mode files that text as a review comment, and the comment is all the agent reading it has — nobody remembers which button was clicked. `leaning=\"Yes\"` beside a two-branch question is a support ticket.\n\n```markdown\n1. **OQ-9: Queue position on re-entry.**\n\n <!-- vantage: oq id=OQ-9 leaning=\"Back of the queue — the fix might interact with what merged while it was out.\" -->\n\n _Leaning:_ Back of the queue.\n```\n\n### Tables, task lists, and math\n- **Tables**: Use standard markdown tables for structured comparisons and schemas.\n- **Task lists**: Use `- [ ]` and `- [x]` for actionable checklists and status tracking.\n- **LaTeX Math**: Use `$$...$$` for *all* KaTeX math — display blocks (`$$` alone on its own lines) and inline alike (`$$E = mc^2$$` mid-sentence).\n - Single dollars are **not** math delimiters: `$HOME` and `$100` stay literal, so prose and shell snippets are safe to write as-is.\n";
1517
1520
  //#endregion
1518
- export { ALERT_TITLES, DIRECTIVE_NAMES, DIRECTIVE_VOCABULARY, DOC_STATUSES, DOC_STATUS_TONES, type DirectivePair, type DirectiveParse, type DirectiveVocabulary, type DocStatus, type FrontmatterFormat, type FrontmatterProblem, type KeyTable, type KeyVocabulary, type MalformedDirective, type ParsedDirective, type ParsedFrontmatter, type Pipeline, type PipelineOptions, type RenderMermaidOptions, type RenderOptions, type RenderResult, type ResolveLinkOptions, SAFE_STYLE, STYLE_GUIDE, VANTAGE_ALERTS, VANTAGE_BADGES, VANTAGE_COLLAPSED, VANTAGE_EMPHASIS, VANTAGE_FRONTMATTER_KEYS, VANTAGE_OQ_HOST_TARGETS, VANTAGE_RUNS, VANTAGE_SENTINEL, VANTAGE_TONES, type VantageAlert, type VantageFrontmatter, type VantageFrontmatterIssue, buildPipeline, buildRemarkPlugins, clearLineAnchorHighlights, hasVantageSentinel, isDocStatus, parseFrontmatter, parseLineAnchor, parseVantageDirective, readVantageFrontmatter, rehypeSourceLines, rehypeVantageAlerts, rehypeVantageDirectives, renderMarkdown, renderMermaidBlocks, resolveLinks, sanitizeSchema, scrollToLineAnchor };
1521
+ export { ALERT_TITLES, DIRECTIVE_NAMES, DIRECTIVE_VOCABULARY, DOC_STATUSES, DOC_STATUS_TONES, type DirectivePair, type DirectiveParse, type DirectiveVocabulary, type DocStatus, type FrontmatterFormat, type FrontmatterProblem, type KeyTable, type KeyVocabulary, type MalformedDirective, type ParsedDirective, type ParsedFrontmatter, type Pipeline, type PipelineOptions, type RenderMermaidOptions, type RenderOptions, type RenderResult, type ResolveLinkOptions, SAFE_STYLE, STYLE_GUIDE, VANTAGE_ALERTS, VANTAGE_BADGES, VANTAGE_COLLAPSED, VANTAGE_EMPHASIS, VANTAGE_FRONTMATTER_KEYS, VANTAGE_OQ_HOST_TARGETS, VANTAGE_RUNS, VANTAGE_SENTINEL, VANTAGE_TONES, type VantageAlert, type VantageFrontmatter, type VantageFrontmatterIssue, buildPipeline, buildRemarkPlugins, clearLineAnchorHighlights, hasVantageSentinel, isDocStatus, parseFrontmatter, parseLineAnchor, parseVantageDirective, readVantageFrontmatter, rehypeSourceLines, rehypeVantageAlerts, rehypeVantageAnchors, rehypeVantageDirectives, renderMarkdown, renderMermaidBlocks, resolveLinks, sanitizeSchema, scrollToLineAnchor };
1519
1522
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/renderMarkdown.ts","../../../node_modules/@types/unist/index.d.ts","../../../node_modules/@types/hast/index.d.ts","../src/rehypeVantageAlerts.ts","../src/rehypeSourceLines.ts","../src/rehypeVantageDirectives.ts","../src/vantageDirectives.ts","../src/pipeline.ts","../src/scrollToLineAnchor.ts","../src/lineAnchor.ts","../src/frontmatter.ts","../src/vantageFrontmatter.ts","../src/sanitize.ts","../src/renderMermaidBlocks.ts","../src/resolveLinks.ts","../src/styleGuide.ts"],"x_google_ignoreList":[1,2],"mappings":";;;;;;;UAaiB;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;UAGe;;EAEf;;EAEA,aAAa;;EAEb;;;;;;;;;;;;;;;;;;iBAmBoB,eACpB,iBACA,UAAS,gBACR,QAAQ;;;;;;;;;;;;;;;;;;;;;;;UCnCM;;;;UAKA;;;;EAIb;;;;EAKA;;;;EAIA;;;;;;;UAQa;;;;EAIb,OAAO;;;;EAKP,KAAK;;;;;;;;;;;;UA6BQ;;;;EAIb;;;;EAKA,OAAO;;;;;;;EAQP,WAAW;;;;;;;;;;;;;;;;;;;;;;;UChFE,aAAa;;;;UAKb;EACb;EACA,QAAQ;EACR;EACA,SAAS;EACT,gBAAgB;EAChB,YAAY;EACZ;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,UAAU;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,eAAe;EACf;EACA,kBAAkB;EAClB;EACA;EACA,iBAAiB;EACjB;EACA;EACA,aAAa;EACb;EACA;EACA;EACA;EACA;EACA;EACA,iBAAiB;EACjB;EACA;EACA;EACA;EACA;EACA;EACA,WAAW;EACX;EACA;EACA;EACA;EACA;EACA;EACA,sBAAsB;EACtB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,eAAe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,WAAW;EACX;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,YAAY;EACZ;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,eAAe;EACf,SAAS;EACT;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,cAAc;EACd;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,KAAK;EACL,KAAK;EACL,YAAY;EACZ;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,UAAU;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,UAAU;EACV,YAAY;EACZ;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,WAAW;EACX,UAAU;EACV;EACA,WAAW;EACX;EACA;EACA;EACA;EACA;EACA,eAAe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,OAAO;EACP;EACA;EACA;EACA;EACA;EACA;EACA;EACA,OAAO;EACP;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,oBAAoB;EACpB;EACA;EACA;EACA;EACA;EACA;EACA,MAAM;EACN;EACA;EACA;EACA;EACA,qBAAqB;EACrB,mBAAmB;EACnB,gBAAgB;EAChB,kBAAkB;EAClB;EACA;EACA;EACA;EACA,eAAe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,UAAU;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,kBAAkB;EAClB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,iBAAiB;EACjB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,SAAS;EACT;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAC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renderMarkdown.ts","../../../node_modules/@types/unist/index.d.ts","../../../node_modules/@types/hast/index.d.ts","../src/rehypeVantageAlerts.ts","../src/rehypeSourceLines.ts","../src/rehypeVantageDirectives.ts","../src/rehypeVantageAnchors.ts","../src/vantageDirectives.ts","../src/pipeline.ts","../src/scrollToLineAnchor.ts","../src/lineAnchor.ts","../src/frontmatter.ts","../src/vantageFrontmatter.ts","../src/sanitize.ts","../src/renderMermaidBlocks.ts","../src/resolveLinks.ts","../src/styleGuide.ts"],"x_google_ignoreList":[1,2],"mappings":";;;;;;;UAaiB;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;UAGe;;EAEf;;EAEA,aAAa;;EAEb;;;;;;;;;;;;;;;;;;iBAmBoB,eACpB,iBACA,UAAS,gBACR,QAAQ;;;;;;;;;;;;;;;;;;;;;;;UCnCM;;;;UAKA;;;;EAIb;;;;EAKA;;;;EAIA;;;;;;;UAQa;;;;EAIb,OAAO;;;;EAKP,KAAK;;;;;;;;;;;;UA6BQ;;;;EAIb;;;;EAKA,OAAO;;;;;;;EAQP,WAAW;;;;;;;;;;;;;;;;;;;;;;;UChFE,aAAa;;;;UAKb;EACb;EACA,QAAQ;EACR;EACA,SAAS;EACT,gBAAgB;EAChB,YAAY;EACZ;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,UAAU;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,eAAe;EACf;EACA,kBAAkB;EAClB;EACA;EACA,iBAAiB;EACjB;EACA;EACA,aAAa;EACb;EACA;EACA;EACA;EACA;EACA;EACA,iBAAiB;EACjB;EACA;EACA;EACA;EACA;EACA;EACA,WAAW;EACX;EACA;EACA;EACA;EACA;EACA;EACA,sBAAsB;EACtB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,eAAe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,WAAW;EACX;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,YAAY;EACZ;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,eAAe;EACf,SAAS;EACT;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,cAAc;EACd;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,KAAK;EACL,KAAK;EACL,YAAY;EACZ;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,UAAU;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,UAAU;EACV,YAAY;EACZ;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,WAAW;EACX,UAAU;EACV;EACA,WAAW;EACX;EACA;EACA;EACA;EACA;EACA,eAAe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,OAAO;EACP;EACA;EACA;EACA;EACA;EACA;EACA;EACA,OAAO;EACP;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,oBAAoB;EACpB;EACA;EACA;EACA;EACA;EACA;EACA,MAAM;EACN;EACA;EACA;EACA;EACA,qBAAqB;EACrB,mBAAmB;EACnB,gBAAgB;EAChB,kBAAkB;EAClB;EACA;EACA;EACA;EACA,eAAe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,UAAU;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,kBAAkB;EAClB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;E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AAS;;;;;;;iBAsBtC,uBACd,aAAa,0BACZ;;;KCpGE,gBAAgB;cA2JR,YAAU;;;;;;;;;;;;;cA2BV,gBAAgB;;;;;;;;;;;;UC1LZ;;EAEf;;EAEA,WAAW,cAAc,OAAO;;;;;;;;;;;;;;;;;;;iBAoBZ,oBACpB,WAAW,aACX,UAAS,uBACR;;;;;;;;;;UChCc;;EAEf;;;;;;EAMA,YAAY,cAAc;;EAE1B;;;;;;;;;;;;;;;;;;;;;;;;;;iBA2Bc,aACd,cACA,UAAS;;;;;;;;;;;;;;;;;cChCE"}
package/dist/index.d.ts CHANGED
@@ -1037,6 +1037,9 @@ declare const rehypeSourceLines: Plugin<[RehypeSourceLinesOptions?], Root>;
1037
1037
  //#region src/rehypeVantageDirectives.d.ts
1038
1038
  declare const rehypeVantageDirectives: Plugin<[], Root>;
1039
1039
  //#endregion
1040
+ //#region src/rehypeVantageAnchors.d.ts
1041
+ declare function rehypeVantageAnchors(): (tree: Root) => void;
1042
+ //#endregion
1040
1043
  //#region src/vantageDirectives.d.ts
1041
1044
  /**
1042
1045
  * The directive grammar and the closed vocabulary — one parser, no renderer.
@@ -1513,7 +1516,7 @@ declare function resolveLinks(html: string, options?: ResolveLinkOptions): strin
1513
1516
  * Every rule stated here should be one a checker can enforce or a renderer
1514
1517
  * actually cares about — if a line is neither, it does not belong.
1515
1518
  */
1516
- declare const STYLE_GUIDE = "## Markdown style guide (for Vantage viewer)\n\nWhen writing or updating markdown documents that will be viewed in Vantage, follow these conventions:\n\n### Structure\n- Use headings (## and ###) to organize content — they become navigable outline anchors.\n- Keep paragraphs focused and concise. Break up dense text with subheadings, lists, or tables.\n\n### Links and cross-references\n- **Relative paths only**: Always link relative to the *current file's directory*:\n - Sibling in same folder: `[Other Doc](./other-doc.md)` or `[Other Doc](other-doc.md)`\n - Subdirectory: `[Design Doc](./design/auth.md)`\n - Parent / sibling folder: `[Overview](../overview.md)` or `[Spec](../specs/api.md)`\n- **Never use leading slashes**:\n - ❌ `[Doc](/docs/guide.md)` (breaks web routing and multi-repo scoping)\n - ✅ `[Doc](../docs/guide.md)` or `[Doc](./guide.md)`\n- **Never use absolute filesystem paths or URI schemes**:\n - ❌ `file:///workspace/docs/guide.md`, `/workspace/docs/guide.md`, `C:\\...`\n - ✅ `[Doc](./guide.md)` or `[Doc](../guide.md)`\n- **Always include the file extension**: Use `.md`, `.ts`, `.go`, etc. (e.g. `[Model](model.go)`).\n- **Line anchors and ranges**:\n - Link to specific lines: `[Handler](../server/api.go#L42)` or `[Range](../server/api.go#L42-L58)`\n - Same-file line anchor: `[See lines](#L10-L25)`\n - Vantage scrolls to and highlights the target lines.\n- **Section anchors**:\n - Same doc: `[Usage](#usage)`\n - Cross-doc: `[Architecture](../overview.md#system-architecture)`\n - Anchor slugs are lowercase, hyphenated, and punctuation-stripped.\n- **Backticks in links**: Place backticks inside the link label, not around the markdown link syntax:\n - ✅ `[`config.json`](./config.json)` or `[config.json](./config.json)`\n - ❌ ``[config.json](./config.json)``\n\n### Frontmatter (Metadata)\n- Include structured metadata at the very top of docs delimited by `---` (YAML) or `+++` (TOML). Vantage renders this as a metadata card:\n```yaml\n---\ntitle: \"Feature Specification\"\nauthor: \"Agent\"\ndate: 2026-08-15\nstatus: in-review # draft | in-review | accepted | deprecated\ntags: [architecture, backend, api]\nsummary: \"Brief description of the document purpose.\"\nvantage:\n status-chip: true # show `status` as a chip above the metadata card\n---\n```\n- **Nothing may sit above the opening delimiter** — not a blank line, not an editorial comment, not a `<!-- vantage: … -->` directive. Frontmatter is recognised only at the very first byte of the file (in Vantage, on GitHub, and in every other reader), so one line above it turns the whole block into body text: a horizontal rule followed by a heading made of the raw keys, with every field lost. `vantage-check` reports it as `frontmatter/not-at-top`.\n- **`vantage:` is Vantage's own reserved key.** It holds chrome that belongs to the file rather than to a section, it never shows up in the metadata card, and every other renderer ignores it. One key today: `status-chip`.\n- **Prefer `status-chip: true`**, which shows the document's own `status:` and therefore cannot disagree with it. A literal `status-chip: accepted` is accepted too, but it is a second value that goes stale on its own — `vantage-check` reports the disagreement.\n- The chip's vocabulary is `status`'s, exactly: `draft | in-review | accepted | deprecated`, lowercase. `Draft` renders no chip at all, silently.\n\n### Mermaid diagrams\n- Use ```mermaid code blocks for flowcharts, sequence diagrams, and architecture diagrams. Vantage provides interactive zoom, pan, dark/light theme adaptation, and SVG export.\n- **Quote labels with special characters**: Always quote node labels containing parentheses, brackets, or colons to prevent syntax errors:\n```mermaid\nflowchart TD\n client[\"Client (React SPA)\"] -->|WebSocket| srv[\"Vantage Server (Go)\"]\n srv --> git[\"Git CLI (git diff)\"]\n```\n\n### Code blocks and diffs\n- Always tag fenced code blocks with language identifiers (`ts`, `go`, `python`, `bash`, `json`, `yaml`, `diff`, `sql`, etc.) for syntax highlighting.\n- For proposed code modifications, use ```diff blocks with `+` and `-` prefixes:\n```diff\n-const oldUrl = \"/api/v1\";\n+const newUrl = \"/api/v2\";\n```\n\n### Callouts and alerts\n- Use GitHub-style blockquote callouts for notes, tips, and warnings:\n> [!NOTE]\n> Background context or helpful explanation.\n\n> [!TIP]\n> Best practice advice or optimization suggestions.\n\n> [!IMPORTANT]\n> Key requirements or crucial information.\n\n> [!WARNING]\n> Urgent caution, breaking changes, or potential pitfalls.\n\n> [!CAUTION]\n> High-risk actions that could cause data loss or security issues.\n\n### Vantage directives (optional, and Vantage-only)\n\nVantage reads a few styling hints from ordinary HTML comments. Every other renderer — GitHub included — drops them, so a document has to read exactly the same without them: directives decorate, they never carry meaning. One goes on a line of its own, with a blank line after it, and applies to the block that follows:\n\n```markdown\n<!-- vantage: section tone=warning badge=stale -->\n\n## Migration path\n\nThe steps below predate the rewrite.\n```\n\n- **Three names**: `section` (the heading and everything under it), `block` (the one block after it), `oq` (one answerable Open Question).\n- **The keys and values are a closed set**: `tone` = `note | tip | important | warning | caution | muted`; `emphasis` = `strong | normal | quiet`; `badge` = `draft | stale | blocked | done | wip`; `collapsed` = `true | false`. Name a *tone*, never a colour — the theme decides what a warning looks like, in light mode, in dark mode, and in print.\n- **Use them sparingly.** One or two per document, on the sections that genuinely differ. A document where everything is toned says nothing, and a rainbow one is harder to read than a plain one.\n- **Anything outside those sets is silently ignored** — nothing breaks, and nothing styles either. Run `vantage-check` on the document: the `vantage/*` rules are the only thing that will ever tell you a directive did nothing.\n- **Always close the comment with `-->`.** Never `--!>`, and never leave it open: Markdown reads every line below an unclosed `<!--` as part of the comment, and the whole rest of the document vanishes from the page. For the same reason `-->` cannot appear *inside* a value — it ends the comment early and spills the remainder into the page as literal text.\n- **In a list, indent the directive inside the item**, with blank lines around it (below). At the start of a line between two items it ends the list and starts a second one, which changes the numbering and the spacing in every renderer — the one thing a directive must never do.\n- **Every open question (💬) with a stated leaning gets an `oq` directive.** The convention's prose — the emoji, the `OQ-N` id, the `_Leaning:_` line, the fill-in `**Answer:**` — produces no button on its own. Writing the convention and stopping there is the most common way this feature goes missing: the questions look complete, review mode is on, and there is nothing to click. **`vantage-check` reports it as an error** (`vantage/oq-missing`), because a question awaiting a ruling that the reviewer cannot file is not a style preference. Mark it 🔒 if it is blocked on something upstream and cannot be answered yet, or ✅ once it is decided; either state needs no directive.\n- **A `leaning` restates the leaning; it is never \"yes\".** The one-click button in review mode files that text as a review comment, and the comment is all the agent reading it has — nobody remembers which button was clicked. `leaning=\"Yes\"` beside a two-branch question is a support ticket.\n\n```markdown\n1. **OQ-9: Queue position on re-entry.**\n\n <!-- vantage: oq id=OQ-9 leaning=\"Back of the queue — the fix might interact with what merged while it was out.\" -->\n\n _Leaning:_ Back of the queue.\n```\n\n### Tables, task lists, and math\n- **Tables**: Use standard markdown tables for structured comparisons and schemas.\n- **Task lists**: Use `- [ ]` and `- [x]` for actionable checklists and status tracking.\n- **LaTeX Math**: Use `$$...$$` for *all* KaTeX math — display blocks (`$$` alone on its own lines) and inline alike (`$$E = mc^2$$` mid-sentence).\n - Single dollars are **not** math delimiters: `$HOME` and `$100` stay literal, so prose and shell snippets are safe to write as-is.\n";
1519
+ declare const STYLE_GUIDE = "## Markdown style guide (for Vantage viewer)\n\nWhen writing or updating markdown documents that will be viewed in Vantage, follow these conventions:\n\n### Structure\n- Use headings (## and ###) to organize content — they become navigable outline anchors.\n- Keep paragraphs focused and concise. Break up dense text with subheadings, lists, or tables.\n\n### Links and cross-references\n- **Relative paths only**: Always link relative to the *current file's directory*:\n - Sibling in same folder: `[Other Doc](./other-doc.md)` or `[Other Doc](other-doc.md)`\n - Subdirectory: `[Design Doc](./design/auth.md)`\n - Parent / sibling folder: `[Overview](../overview.md)` or `[Spec](../specs/api.md)`\n- **Never use leading slashes**:\n - ❌ `[Doc](/docs/guide.md)` (breaks web routing and multi-repo scoping)\n - ✅ `[Doc](../docs/guide.md)` or `[Doc](./guide.md)`\n- **Never use absolute filesystem paths or URI schemes**:\n - ❌ `file:///workspace/docs/guide.md`, `/workspace/docs/guide.md`, `C:\\...`\n - ✅ `[Doc](./guide.md)` or `[Doc](../guide.md)`\n- **Always include the file extension**: Use `.md`, `.ts`, `.go`, etc. (e.g. `[Model](model.go)`).\n- **Line anchors and ranges**:\n - Link to specific lines: `[Handler](../server/api.go#L42)` or `[Range](../server/api.go#L42-L58)`\n - Same-file line anchor: `[See lines](#L10-L25)`\n - Vantage scrolls to and highlights the target lines.\n- **Section anchors**:\n - Same doc: `[Usage](#usage)`\n - Cross-doc: `[Architecture](../overview.md#system-architecture)`\n - Anchor slugs are lowercase, hyphenated, and punctuation-stripped.\n- **Backticks in links**: Place backticks inside the link label, not around the markdown link syntax:\n - ✅ `[`config.json`](./config.json)` or `[config.json](./config.json)`\n - ❌ ``[config.json](./config.json)``\n\n### Frontmatter (Metadata)\n- Include structured metadata at the very top of docs delimited by `---` (YAML) or `+++` (TOML). Vantage renders this as a metadata card:\n```yaml\n---\ntitle: \"Feature Specification\"\nauthor: \"Agent\"\ndate: 2026-08-15\nstatus: in-review # draft | in-review | accepted | deprecated\ntags: [architecture, backend, api]\nsummary: \"Brief description of the document purpose.\"\nvantage:\n status-chip: true # show `status` as a chip above the metadata card\n---\n```\n- **Nothing may sit above the opening delimiter** — not a blank line, not an editorial comment, not a `<!-- vantage: … -->` directive. Frontmatter is recognised only at the very first byte of the file (in Vantage, on GitHub, and in every other reader), so one line above it turns the whole block into body text: a horizontal rule followed by a heading made of the raw keys, with every field lost. `vantage-check` reports it as `frontmatter/not-at-top`.\n- **`vantage:` is Vantage's own reserved key.** It holds chrome that belongs to the file rather than to a section, it never shows up in the metadata card, and every other renderer ignores it. One key today: `status-chip`.\n- **Prefer `status-chip: true`**, which shows the document's own `status:` and therefore cannot disagree with it. A literal `status-chip: accepted` is accepted too, but it is a second value that goes stale on its own — `vantage-check` reports the disagreement.\n- The chip's vocabulary is `status`'s, exactly: `draft | in-review | accepted | deprecated`, lowercase. `Draft` renders no chip at all, silently.\n\n### Mermaid diagrams\n- Use ```mermaid code blocks for flowcharts, sequence diagrams, and architecture diagrams. Vantage provides interactive zoom, pan, dark/light theme adaptation, and SVG export.\n- **Quote labels with special characters**: Always quote node labels containing parentheses, brackets, or colons to prevent syntax errors:\n```mermaid\nflowchart TD\n client[\"Client (React SPA)\"] -->|WebSocket| srv[\"Vantage Server (Go)\"]\n srv --> git[\"Git CLI (git diff)\"]\n```\n\n### Code blocks and diffs\n- Always tag fenced code blocks with language identifiers (`ts`, `go`, `python`, `bash`, `json`, `yaml`, `diff`, `sql`, etc.) for syntax highlighting.\n- For proposed code modifications, use ```diff blocks with `+` and `-` prefixes:\n```diff\n-const oldUrl = \"/api/v1\";\n+const newUrl = \"/api/v2\";\n```\n\n### Callouts and alerts\n- Use GitHub-style blockquote callouts for notes, tips, and warnings:\n> [!NOTE]\n> Background context or helpful explanation.\n\n> [!TIP]\n> Best practice advice or optimization suggestions.\n\n> [!IMPORTANT]\n> Key requirements or crucial information.\n\n> [!WARNING]\n> Urgent caution, breaking changes, or potential pitfalls.\n\n> [!CAUTION]\n> High-risk actions that could cause data loss or security issues.\n\n### Vantage directives (optional, and Vantage-only)\n\nVantage reads a few styling hints from ordinary HTML comments. Every other renderer — GitHub included — drops them, so a document has to read exactly the same without them: directives decorate, they never carry meaning. One goes on a line of its own, with a blank line after it, and applies to the block that follows:\n\n```markdown\n<!-- vantage: section tone=warning badge=stale -->\n\n## Migration path\n\nThe steps below predate the rewrite.\n```\n\n- **Three names**: `section` (the heading and everything under it), `block` (the one block after it), `oq` (one answerable Open Question).\n- **The keys and values are a closed set**: `tone` = `note | tip | important | warning | caution | muted`; `emphasis` = `strong | normal | quiet`; `badge` = `draft | stale | blocked | done | wip`; `collapsed` = `true | false`. Name a *tone*, never a colour — the theme decides what a warning looks like, in light mode, in dark mode, and in print.\n- **Use them sparingly.** One or two per document, on the sections that genuinely differ. A document where everything is toned says nothing, and a rainbow one is harder to read than a plain one.\n- **Anything outside those sets is silently ignored** — nothing breaks, and nothing styles either. Run `vantage-check` on the document: the `vantage/*` rules are the only thing that will ever tell you a directive did nothing.\n- **Always close the comment with `-->`.** Never `--!>`, and never leave it open: Markdown reads every line below an unclosed `<!--` as part of the comment, and the whole rest of the document vanishes from the page. For the same reason `-->` cannot appear *inside* a value — it ends the comment early and spills the remainder into the page as literal text.\n- **In a list, indent the directive inside the item**, with blank lines around it (below). At the start of a line between two items it ends the list and starts a second one, which changes the numbering and the spacing in every renderer — the one thing a directive must never do.\n- **An open question's id is `OQ-` then an optional short uppercase prefix then digits** — `OQ-9`, `OQ-TP6`, `OQ-A03`. The prefix is what keeps ids distinct once one document references another's questions, so use one in both whenever they cross-reference. `vantage-check` reports anything outside that shape as `vantage/oq-id-format`, and the same id twice in one document as `vantage/oq-id-duplicate` — both are silent otherwise, because the id becomes the block's anchor and a refused or duplicated one simply goes nowhere.\n- **A reference is a link, or it is a lie.** An `OQ-` id, a `§N` section number and a filename all read like pointers, and written as bare prose none of them can be followed or checked — which is exactly why a stale one is never caught. Link the question to its anchor (`[OQ-4](#OQ-4)`, or the Decision Ledger once it is compacted), the section to its heading, the filename to the file. `vantage-check` reports all three (`ref/*`) as errors, and checks that the link points at the thing the reference names rather than merely at something. Writing a specimen rather than a reference? Put it in a fenced block, which the rules never read.\n- **Every open question (💬) with a stated leaning gets an `oq` directive.** The convention's prose — the emoji, the `OQ-N` id, the `_Leaning:_` line, the fill-in `**Answer:**` — produces no button on its own. Writing the convention and stopping there is the most common way this feature goes missing: the questions look complete, review mode is on, and there is nothing to click. **`vantage-check` reports it as an error** (`vantage/oq-missing`), because a question awaiting a ruling that the reviewer cannot file is not a style preference. Mark it 🔒 if it is blocked on something upstream and cannot be answered yet, or ✅ once it is decided; either state needs no directive.\n- **A `leaning` restates the leaning; it is never \"yes\".** The one-click button in review mode files that text as a review comment, and the comment is all the agent reading it has — nobody remembers which button was clicked. `leaning=\"Yes\"` beside a two-branch question is a support ticket.\n\n```markdown\n1. **OQ-9: Queue position on re-entry.**\n\n <!-- vantage: oq id=OQ-9 leaning=\"Back of the queue — the fix might interact with what merged while it was out.\" -->\n\n _Leaning:_ Back of the queue.\n```\n\n### Tables, task lists, and math\n- **Tables**: Use standard markdown tables for structured comparisons and schemas.\n- **Task lists**: Use `- [ ]` and `- [x]` for actionable checklists and status tracking.\n- **LaTeX Math**: Use `$$...$$` for *all* KaTeX math — display blocks (`$$` alone on its own lines) and inline alike (`$$E = mc^2$$` mid-sentence).\n - Single dollars are **not** math delimiters: `$HOME` and `$100` stay literal, so prose and shell snippets are safe to write as-is.\n";
1517
1520
  //#endregion
1518
- export { ALERT_TITLES, DIRECTIVE_NAMES, DIRECTIVE_VOCABULARY, DOC_STATUSES, DOC_STATUS_TONES, type DirectivePair, type DirectiveParse, type DirectiveVocabulary, type DocStatus, type FrontmatterFormat, type FrontmatterProblem, type KeyTable, type KeyVocabulary, type MalformedDirective, type ParsedDirective, type ParsedFrontmatter, type Pipeline, type PipelineOptions, type RenderMermaidOptions, type RenderOptions, type RenderResult, type ResolveLinkOptions, SAFE_STYLE, STYLE_GUIDE, VANTAGE_ALERTS, VANTAGE_BADGES, VANTAGE_COLLAPSED, VANTAGE_EMPHASIS, VANTAGE_FRONTMATTER_KEYS, VANTAGE_OQ_HOST_TARGETS, VANTAGE_RUNS, VANTAGE_SENTINEL, VANTAGE_TONES, type VantageAlert, type VantageFrontmatter, type VantageFrontmatterIssue, buildPipeline, buildRemarkPlugins, clearLineAnchorHighlights, hasVantageSentinel, isDocStatus, parseFrontmatter, parseLineAnchor, parseVantageDirective, readVantageFrontmatter, rehypeSourceLines, rehypeVantageAlerts, rehypeVantageDirectives, renderMarkdown, renderMermaidBlocks, resolveLinks, sanitizeSchema, scrollToLineAnchor };
1521
+ export { ALERT_TITLES, DIRECTIVE_NAMES, DIRECTIVE_VOCABULARY, DOC_STATUSES, DOC_STATUS_TONES, type DirectivePair, type DirectiveParse, type DirectiveVocabulary, type DocStatus, type FrontmatterFormat, type FrontmatterProblem, type KeyTable, type KeyVocabulary, type MalformedDirective, type ParsedDirective, type ParsedFrontmatter, type Pipeline, type PipelineOptions, type RenderMermaidOptions, type RenderOptions, type RenderResult, type ResolveLinkOptions, SAFE_STYLE, STYLE_GUIDE, VANTAGE_ALERTS, VANTAGE_BADGES, VANTAGE_COLLAPSED, VANTAGE_EMPHASIS, VANTAGE_FRONTMATTER_KEYS, VANTAGE_OQ_HOST_TARGETS, VANTAGE_RUNS, VANTAGE_SENTINEL, VANTAGE_TONES, type VantageAlert, type VantageFrontmatter, type VantageFrontmatterIssue, buildPipeline, buildRemarkPlugins, clearLineAnchorHighlights, hasVantageSentinel, isDocStatus, parseFrontmatter, parseLineAnchor, parseVantageDirective, readVantageFrontmatter, rehypeSourceLines, rehypeVantageAlerts, rehypeVantageAnchors, rehypeVantageDirectives, renderMarkdown, renderMermaidBlocks, resolveLinks, sanitizeSchema, scrollToLineAnchor };
1519
1522
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/renderMarkdown.ts","../../../node_modules/@types/unist/index.d.ts","../../../node_modules/@types/hast/index.d.ts","../src/rehypeVantageAlerts.ts","../src/rehypeSourceLines.ts","../src/rehypeVantageDirectives.ts","../src/vantageDirectives.ts","../src/pipeline.ts","../src/scrollToLineAnchor.ts","../src/lineAnchor.ts","../src/frontmatter.ts","../src/vantageFrontmatter.ts","../src/sanitize.ts","../src/renderMermaidBlocks.ts","../src/resolveLinks.ts","../src/styleGuide.ts"],"x_google_ignoreList":[1,2],"mappings":";;;;;;;UAaiB;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;UAGe;;EAEf;;EAEA,aAAa;;EAEb;;;;;;;;;;;;;;;;;;iBAmBoB,eACpB,iBACA,UAAS,gBACR,QAAQ;;;;;;;;;;;;;;;;;;;;;;;UCnCM;;;;UAKA;;;;EAIb;;;;EAKA;;;;EAIA;;;;;;;UAQa;;;;EAIb,OAAO;;;;EAKP,KAAK;;;;;;;;;;;;UA6BQ;;;;EAIb;;;;EAKA,OAAO;;;;;;;EAQP,WAAW;;;;;;;;;;;;;;;;;;;;;;;UChFE,aAAa;;;;UAKb;EACb;EACA,QAAQ;EACR;EACA,SAAS;EACT,gBAAgB;EAChB,YAAY;EACZ;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,UAAU;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,eAAe;EACf;EACA,kBAAkB;EAClB;EACA;EACA,iBAAiB;EACjB;EACA;EACA,aAAa;EACb;EACA;EACA;EACA;EACA;EACA;EACA,iBAAiB;EACjB;EACA;EACA;EACA;EACA;EACA;EACA,WAAW;EACX;EACA;EACA;EACA;EACA;EACA;EACA,sBAAsB;EACtB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,eAAe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,WAAW;EACX;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,YAAY;EACZ;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,eAAe;EACf,SAAS;EACT;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,cAAc;EACd;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,KAAK;EACL,KAAK;EACL,YAAY;EACZ;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,UAAU;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,UAAU;EACV,YAAY;EACZ;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,WAAW;EACX,UAAU;EACV;EACA,WAAW;EACX;EACA;EACA;EACA;EACA;EACA,eAAe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,OAAO;EACP;EACA;EACA;EACA;EACA;EACA;EACA;EACA,OAAO;EACP;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,oBAAoB;EACpB;EACA;EACA;EACA;EACA;EACA;EACA,MAAM;EACN;EACA;EACA;EACA;EACA,qBAAqB;EACrB,mBAAmB;EACnB,gBAAgB;EAChB,kBAAkB;EAClB;EACA;EACA;EACA;EACA,eAAe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,UAAU;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,kBAAkB;EAClB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,iBAAiB;EACjB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA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Ac,OAAO;;;;;;;;;;;;;;;;;;;iBAoBZ,oBACpB,WAAW,aACX,UAAS,uBACR;;;;;;;;;;UChCc;;EAEf;;;;;;EAMA,YAAY,cAAc;;EAE1B;;;;;;;;;;;;;;;;;;;;;;;;;;iBA2Bc,aACd,cACA,UAAS;;;;;;;;;;;;;;;;;cChCE"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/renderMarkdown.ts","../../../node_modules/@types/unist/index.d.ts","../../../node_modules/@types/hast/index.d.ts","../src/rehypeVantageAlerts.ts","../src/rehypeSourceLines.ts","../src/rehypeVantageDirectives.ts","../src/rehypeVantageAnchors.ts","../src/vantageDirectives.ts","../src/pipeline.ts","../src/scrollToLineAnchor.ts","../src/lineAnchor.ts","../src/frontmatter.ts","../src/vantageFrontmatter.ts","../src/sanitize.ts","../src/renderMermaidBlocks.ts","../src/resolveLinks.ts","../src/styleGuide.ts"],"x_google_ignoreList":[1,2],"mappings":";;;;;;;UAaiB;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;UAGe;;EAEf;;EAEA,aAAa;;EAEb;;;;;;;;;;;;;;;;;;iBAmBoB,eACpB,iBACA,UAAS,gBACR,QAAQ;;;;;;;;;;;;;;;;;;;;;;;UCnCM;;;;UAKA;;;;EAIb;;;;EAKA;;;;EAIA;;;;;;;UAQa;;;;EAIb,OAAO;;;;EAKP,KAAK;;;;;;;;;;;;UA6BQ;;;;EAIb;;;;EAKA,OAAO;;;;;;;EAQP,WAAW;;;;;;;;;;;;;;;;;;;;;;;UChFE,aAAa;;;;UAKb;EACb;EACA,QAAQ;EACR;EACA,SAAS;EACT,gBAAgB;EAChB,YAAY;EACZ;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,UAAU;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,eAAe;EACf;EACA,kBAAkB;EAClB;EACA;EACA,iBAAiB;EACjB;EACA;EACA,aAAa;EACb;EACA;EACA;EACA;EACA;EACA;EACA,iBAAiB;EACjB;EACA;EACA;EACA;EACA;EACA;EACA,WAAW;EACX;EACA;EACA;EACA;EACA;EACA;EACA,sBAAsB;EACtB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,eAAe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,WAAW;EACX;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,YAAY;EACZ;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,eAAe;EACf,SAAS;EACT;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,cAAc;EACd;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,KAAK;EACL,KAAK;EACL,YAAY;EACZ;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,UAAU;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,UAAU;EACV,YAAY;EACZ;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,WAAW;EACX,UAAU;EACV;EACA,WAAW;EACX;EACA;EACA;EACA;EACA;EACA,eAAe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,OAAO;EACP;EACA;EACA;EACA;EACA;EACA;EACA;EACA,OAAO;EACP;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,oBAAoB;EACpB;EACA;EACA;EACA;EACA;EACA;EACA,MAAM;EACN;EACA;EACA;EACA;EACA,qBAAqB;EACrB,mBAAmB;EACnB,gBAAgB;EAChB,kBAAkB;EAClB;EACA;EACA;EACA;EACA,eAAe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,UAAU;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,kBAAkB;EAClB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,iBAAiB;EACjB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,SAAS;EACT;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;GACC,sEAAsE;;;;;;;;;KAW/D,iBAAiB,wBAAwB;;;;;;UAOpC;EACb,SAAS;EACT,SAAS;EACT,MAAM;;;;;;;;KASE,cAAc,qBAAqB;;;;;;;;;UAU9B;EACb,SAAS;EACT,SAAS;EACT,SAAS;EACT,MAAM;;;;;;;;;;;;;;;;UAsDO,aAAa;;;;EAI1B,OAAO;;;;;;;;;UAUM,gBAAgB;;;;EAI7B;;;;;;;;;UAUa,eAAe;;;;EAI5B,UAAU;;;;;;UAQG,gBAAgB;;;;EAI7B;;;;EAIA,OAAO;;;;;UAMM,oBAAoB;;;;UAKpB,gBAAgB;;;;EAI7B;;;;EAIA,OAAO;;;;;UAMM,oBAAoB;;;;UAKpB,gBAAgB;;;;EAI7B;;;;EAIA;;;;EAIA,YAAY;;;;EAIZ,UAAU;;;;;EAKV,UAAU;;;;EAIV,OAAO;;;;;UAMM,oBAAoB;;;;;;;;UAS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;cC1BtC;KAOD,oBAAoB;;cAGnB;;;;;;;;;;cAWA,kBAAkB,SAC7B,OAAO,mBAAmB;;;;;;;;KAehB;EACN;EAAqB;;EACrB;EAAqB;;EACrB;EAAmB;EAAa;EAAgB;;EAChD;EAA4B;;EAC5B;EAA+B,MAAM;EAAW;;UAErC;;EAEf,aAAa;;EAEb,QAAQ;;;iBAWM,YAAY,iBAAiB,SAAS;;;;;;;iBAsBtC,uBACd,aAAa,0BACZ;;;KCpGE,gBAAgB;cA2JR,YAAU;;;;;;;;;;;;;cA2BV,gBAAgB;;;;;;;;;;;;UC1LZ;;EAEf;;EAEA,WAAW,cAAc,OAAO;;;;;;;;;;;;;;;;;;;iBAoBZ,oBACpB,WAAW,aACX,UAAS,uBACR;;;;;;;;;;UChCc;;EAEf;;;;;;EAMA,YAAY,cAAc;;EAE1B;;;;;;;;;;;;;;;;;;;;;;;;;;iBA2Bc,aACd,cACA,UAAS;;;;;;;;;;;;;;;;;cChCE"}
package/dist/index.js CHANGED
@@ -12,6 +12,21 @@ import rehypeSlug from "rehype-slug";
12
12
  import { visit } from "unist-util-visit";
13
13
  import YAML from "yaml";
14
14
  import { parse } from "smol-toml";
15
+ //#region src/rehypeVantageAnchors.ts
16
+ /** What `rehypeVantageDirectives` stamps, in hast property form. */
17
+ const OQ_ID_PROPERTY$1 = "dataVantageOqId";
18
+ function rehypeVantageAnchors() {
19
+ return (tree) => {
20
+ visit(tree, "element", (node) => {
21
+ const carried = node.properties?.[OQ_ID_PROPERTY$1];
22
+ if (typeof carried !== "string" || carried === "") return;
23
+ delete node.properties[OQ_ID_PROPERTY$1];
24
+ if (typeof node.properties.id === "string" && node.properties.id !== "") return;
25
+ node.properties.id = carried;
26
+ });
27
+ };
28
+ }
29
+ //#endregion
15
30
  //#region src/rehypeSourceLines.ts
16
31
  /**
17
32
  * Tags that get a `data-source-line`.
@@ -283,12 +298,17 @@ const VANTAGE_RUNS = [
283
298
  "only"
284
299
  ];
285
300
  /**
286
- * The tags a `section`/`block` directive may stamp.
301
+ * The tags a `section`/`block` directive may **target**.
302
+ *
303
+ * Deliberately `rehypeSourceLines`'s `BLOCK_TAGS`: a directive's target should
304
+ * also be a block with a `data-source-line`, so the styling surface and the
305
+ * anchor surface coincide. It also keeps an inline directive from stamping the
306
+ * `<em>` that happens to follow it inside a paragraph.
287
307
  *
288
- * Deliberately `rehypeSourceLines`'s `BLOCK_TAGS`: a stamped block should also
289
- * be a block with a `data-source-line`, so the styling surface and the anchor
290
- * surface coincide. It also keeps an inline directive from stamping the `<em>`
291
- * that happens to follow it inside a paragraph.
308
+ * It does **not** bound a `section`'s range. Every element in the span is
309
+ * stamped, on the tag list or not, because a member only has to be a box in the
310
+ * flow for the section's vertical rule to cross it — see `styleRange` in
311
+ * `rehypeVantageDirectives.ts` for the hole that restricting the range left.
292
312
  *
293
313
  * It lives here rather than in the plugin because the CLI checker has to answer
294
314
  * "will this directive stamp anything?" from an mdast tree with no hast in
@@ -355,6 +375,23 @@ const VANTAGE_ANCHOR_TARGETS = [
355
375
  * and said nothing, which is the D5 break this module exists to prevent.
356
376
  */
357
377
  const VANTAGE_OQ_HOST_TARGETS = VANTAGE_ANCHOR_TARGETS.filter((tag) => tag !== "pre" && tag !== "table");
378
+ /**
379
+ * The shape of an `oq` directive's `id`: `OQ-` then an optional short uppercase
380
+ * prefix then digits. `OQ-9`, `OQ-TP6` and `OQ-A03` are ids; `OQ-foo`, `OQ-tp6`
381
+ * and a bare `OQ6` are not.
382
+ *
383
+ * The prefix is what keeps ids distinct once one document references another's
384
+ * questions — `trust-paths.md`'s `OQ-4` and a design sketch's `OQ-4` are
385
+ * different questions, and a bare number cannot say which one a cross-document
386
+ * reference means. It is optional because most documents never leave their own
387
+ * file, and requiring it everywhere would fire on every single-doc sketch.
388
+ *
389
+ * Three consumers read it from here and none of them may re-spell it: the
390
+ * plugin that stamps the anchor, the sanitiser that allowlists the value, and
391
+ * the checker's `vantage/oq-id-format`. A fourth copy is how the checker starts
392
+ * calling a working anchor malformed.
393
+ */
394
+ const VANTAGE_OQ_ID = /^OQ-(?:[A-Z][A-Z0-9]{0,5})?[0-9]+$/;
358
395
  const STYLE_KEYS = {
359
396
  tone: VANTAGE_TONES,
360
397
  emphasis: VANTAGE_EMPHASIS,
@@ -497,11 +534,13 @@ function parseVantageDirective(comment) {
497
534
  //#endregion
498
535
  //#region src/rehypeVantageDirectives.ts
499
536
  /**
500
- * What a `section`/`block` and an `oq` directive may stamp.
537
+ * What a `section`/`block` and an `oq` directive may **target**.
501
538
  *
502
539
  * Both lists live in `vantageDirectives.ts`, with the reasoning for each tag,
503
540
  * because the CLI checker resolves the same question over mdast and must reach
504
541
  * the same answer (D5).
542
+ *
543
+ * Neither list bounds a `section`'s range: see `styleRange`.
505
544
  */
506
545
  const STYLE_TARGET_TAGS = new Set(VANTAGE_STYLE_TARGETS);
507
546
  const ANCHOR_TARGET_TAGS = new Set(VANTAGE_ANCHOR_TARGETS);
@@ -548,6 +587,18 @@ const RUN_PROPERTY = "dataVantageRun";
548
587
  const OQ_PROPERTY = "dataVantageOq";
549
588
  const LEANING_PROPERTY = "dataVantageLeaning";
550
589
  /**
590
+ * The id, carried as a `data-` attribute rather than written straight to `id`.
591
+ *
592
+ * This plugin runs *before* `rehypeSanitize` — it has to, it reads comments and
593
+ * the sanitiser deletes them — and the sanitiser's default schema clobbers `id`
594
+ * with the prefix `user-content-`. A bare `id` set here would reach the page as
595
+ * `user-content-OQ-4`, every `#OQ-4` link in every document would land nowhere,
596
+ * and nothing would error. `rehypeVantageAnchors` promotes this to a real `id`
597
+ * on the other side of the sanitiser, which is the same reason `rehypeSlug` is
598
+ * registered there (`pipeline.ts`).
599
+ */
600
+ const OQ_ID_PROPERTY = "dataVantageOqId";
601
+ /**
551
602
  * The three properties `collapsed=true` stamps across a section.
552
603
  *
553
604
  * The heading takes a *different* attribute from the blocks it hides, and that
@@ -620,6 +671,22 @@ function accepts(name, key, value) {
620
671
  * `section` before anything else degrades to that one block, and `block` is
621
672
  * always that one block. A heading nested inside a stamped `blockquote` or
622
673
  * `li` does not end the section: the walk never descends.
674
+ *
675
+ * **Every element in the span, not only a `VANTAGE_STYLE_TARGETS` one.** That
676
+ * list gates the *target* and nothing else. Restricting the range to it as well
677
+ * used to leave a raw-HTML `<figure>`, `<dl>` or `<details>` unstamped between
678
+ * two stamped paragraphs — and the section's one continuous vertical rule is
679
+ * drawn per member, so an unstamped member is a hole the height of the block
680
+ * plus its margins. Measured over the real stylesheet: 44px for a one-line
681
+ * `<figure>`, against the 40px a neighbour can bleed upward, and arbitrarily
682
+ * large for anything taller. `collapsed=true` had the same shape of bug the
683
+ * other way round — it hid the paragraphs and left the figure on the page.
684
+ *
685
+ * The two lists answering different questions is the point, not an oversight:
686
+ * a *target* must be a block a review anchor can name, because a directive
687
+ * pointing at something unanchorable is a directive with no addressable effect.
688
+ * A *member* only has to be a box in the flow, because all it does is carry the
689
+ * run's tone across itself.
623
690
  */
624
691
  function styleRange(children, targetIndex, name) {
625
692
  const range = [targetIndex];
@@ -629,7 +696,7 @@ function styleRange(children, targetIndex, name) {
629
696
  const node = children[i];
630
697
  const nodeDepth = headingDepth(node);
631
698
  if (nodeDepth !== void 0 && nodeDepth <= depth) break;
632
- if (node.type === "element" && STYLE_TARGET_TAGS.has(node.tagName)) range.push(i);
699
+ if (node.type === "element") range.push(i);
633
700
  }
634
701
  return range;
635
702
  }
@@ -688,6 +755,8 @@ function stampStyle(children, targetIndex, name, pairs, state) {
688
755
  }
689
756
  function stampOq(target, pairs) {
690
757
  setProperty(target, OQ_PROPERTY, "true");
758
+ const id = pairs.get("id");
759
+ if (id !== void 0 && id !== "") setProperty(target, OQ_ID_PROPERTY, id);
691
760
  const leaning = pairs.get("leaning");
692
761
  if (leaning === void 0) return;
693
762
  const text = leaning.replace(/\s+/g, " ").trim().slice(0, MAX_LEANING);
@@ -993,6 +1062,7 @@ const sanitizeSchema = {
993
1062
  ["dataVantageCollapseToggle", COLLAPSE_GROUP_ID],
994
1063
  ["dataVantageRun", ...VANTAGE_RUNS],
995
1064
  ["dataVantageOq", "true"],
1065
+ ["dataVantageOqId", VANTAGE_OQ_ID],
996
1066
  ["dataVantageAlert", ...VANTAGE_ALERTS],
997
1067
  "dataVantageLeaning"
998
1068
  ],
@@ -1042,6 +1112,7 @@ function buildRehypePlugins(options = {}) {
1042
1112
  plugins.push(rehypeVantageAlerts);
1043
1113
  plugins.push(rehypeVantageDirectives);
1044
1114
  if (sanitize) plugins.push([rehypeSanitize, sanitizeSchema]);
1115
+ plugins.push(rehypeVantageAnchors);
1045
1116
  plugins.push(rehypeSlug);
1046
1117
  if (highlight) plugins.push(rehypeHighlight);
1047
1118
  if (math) plugins.push(rehypeCaptureMathStamps, rehypeKatex, rehypeRestoreMathStamps);
@@ -1435,27 +1506,92 @@ function readStatusChip(frontmatter, raw, issues) {
1435
1506
  });
1436
1507
  }
1437
1508
  //#endregion
1509
+ //#region src/mermaidTheme.ts
1510
+ /** Whether the document is asking for the dark palette right now. */
1511
+ function currentMermaidTheme() {
1512
+ return typeof document !== "undefined" && document.documentElement.classList.contains("dark") ? "dark" : "default";
1513
+ }
1514
+ /**
1515
+ * Theme variables per theme. Mermaid derives most of its palette from these, so
1516
+ * the set is deliberately small: the surfaces, the ink, and the lines.
1517
+ */
1518
+ const THEME_VARIABLES = {
1519
+ dark: {
1520
+ background: "#1d293d",
1521
+ mainBkg: "#314158",
1522
+ nodeBorder: "#90a1b9",
1523
+ nodeTextColor: "#f1f5f9",
1524
+ lineColor: "#90a1b9",
1525
+ textColor: "#e2e8f0",
1526
+ edgeLabelBackground: "#1d293d"
1527
+ },
1528
+ default: {
1529
+ background: "#f8fafc",
1530
+ mainBkg: "#f1f5f9",
1531
+ nodeBorder: "#62748e",
1532
+ nodeTextColor: "#0f172b",
1533
+ lineColor: "#62748e",
1534
+ textColor: "#1d293d",
1535
+ edgeLabelBackground: "#f8fafc"
1536
+ }
1537
+ };
1538
+ function mermaidThemeVariables(theme) {
1539
+ return THEME_VARIABLES[theme];
1540
+ }
1541
+ //#endregion
1438
1542
  //#region src/mermaidCache.ts
1439
1543
  const svgCache = /* @__PURE__ */ new Map();
1544
+ const cacheKey = (code, theme) => `${theme}${code}`;
1545
+ /** The SVG for this fence in the theme the page is currently asking for. */
1546
+ function getCachedSvg(code, theme = currentMermaidTheme()) {
1547
+ return svgCache.get(cacheKey(code, theme));
1548
+ }
1549
+ function setCachedSvg(code, svg, theme = currentMermaidTheme()) {
1550
+ svgCache.set(cacheKey(code, theme), svg);
1551
+ }
1440
1552
  //#endregion
1441
1553
  //#region src/mermaidLoader.ts
1442
1554
  let mermaidInstance = null;
1443
1555
  let mermaidLoading = null;
1444
- const isDark = () => typeof document !== "undefined" && document.documentElement.classList.contains("dark");
1556
+ /** The theme the loaded instance was last configured for, `null` until loaded. */
1557
+ let configuredTheme = null;
1558
+ function configure(m, theme) {
1559
+ m.initialize({
1560
+ startOnLoad: false,
1561
+ theme,
1562
+ themeVariables: mermaidThemeVariables(theme),
1563
+ securityLevel: "strict",
1564
+ suppressErrorRendering: true
1565
+ });
1566
+ configuredTheme = theme;
1567
+ }
1568
+ /**
1569
+ * The mermaid module, configured for the theme the page is asking for *now*.
1570
+ *
1571
+ * Re-configuring on a theme change is the point. `initialize` used to run once,
1572
+ * on first import, so every diagram rendered after a light/dark switch still
1573
+ * came out in the palette the session started in — a white slab of a flowchart
1574
+ * on the dark page, or a black one on the light page. `initialize` merges into
1575
+ * mermaid's global config, so calling it again is how the next `render` picks
1576
+ * the new palette up; the cache is keyed by theme so the old SVGs are not
1577
+ * served instead (`mermaidCache.ts`).
1578
+ */
1445
1579
  async function getMermaid() {
1446
- if (mermaidInstance) return mermaidInstance;
1580
+ const theme = currentMermaidTheme();
1581
+ if (mermaidInstance) {
1582
+ if (configuredTheme !== theme) configure(mermaidInstance, theme);
1583
+ return mermaidInstance;
1584
+ }
1447
1585
  if (!mermaidLoading) mermaidLoading = import("mermaid").then((mod) => {
1448
1586
  const m = mod.default;
1449
- m.initialize({
1450
- startOnLoad: false,
1451
- theme: isDark() ? "dark" : "default",
1452
- securityLevel: "strict",
1453
- suppressErrorRendering: true
1454
- });
1587
+ configure(m, currentMermaidTheme());
1455
1588
  mermaidInstance = m;
1456
1589
  return m;
1457
1590
  });
1458
- return mermaidLoading;
1591
+ const loaded = await mermaidLoading;
1592
+ const wanted = currentMermaidTheme();
1593
+ if (configuredTheme !== wanted) configure(loaded, wanted);
1594
+ return loaded;
1459
1595
  }
1460
1596
  //#endregion
1461
1597
  //#region src/renderMermaidBlocks.ts
@@ -1489,18 +1625,20 @@ async function renderMermaidBlocks(container, options = {}) {
1489
1625
  const { className = "mermaid", onError } = options;
1490
1626
  const codeBlocks = container.querySelectorAll("pre > code.language-mermaid, pre > code[class*=\"language-mermaid\"]");
1491
1627
  if (codeBlocks.length === 0) return;
1492
- const mermaid = await getMermaid();
1628
+ let loading;
1629
+ const mermaidOnce = () => loading ??= getMermaid();
1493
1630
  const renderPromises = Array.from(codeBlocks).map(async (codeEl) => {
1494
1631
  const preEl = codeEl.parentElement;
1495
1632
  if (!preEl) return;
1496
1633
  const code = codeEl.textContent || "";
1497
1634
  if (!code.trim()) return;
1498
- const cached = svgCache.get(code);
1635
+ const cached = getCachedSvg(code);
1499
1636
  if (cached) {
1500
1637
  replaceWithSvg(preEl, cached, className);
1501
1638
  return;
1502
1639
  }
1503
1640
  try {
1641
+ const mermaid = await mermaidOnce();
1504
1642
  let hash = 0;
1505
1643
  for (let i = 0; i < code.length; i++) {
1506
1644
  hash = (hash << 5) - hash + code.charCodeAt(i);
@@ -1508,7 +1646,7 @@ async function renderMermaidBlocks(container, options = {}) {
1508
1646
  }
1509
1647
  const id = `mermaid-${Math.abs(hash).toString(36)}-${Date.now()}`;
1510
1648
  const { svg } = await mermaid.render(id, code);
1511
- svgCache.set(code, svg);
1649
+ setCachedSvg(code, svg);
1512
1650
  replaceWithSvg(preEl, svg, className);
1513
1651
  } catch (err) {
1514
1652
  if (onError) onError(code, err instanceof Error ? err : new Error(String(err)));
@@ -1516,9 +1654,34 @@ async function renderMermaidBlocks(container, options = {}) {
1516
1654
  });
1517
1655
  await Promise.all(renderPromises);
1518
1656
  }
1657
+ /**
1658
+ * Attributes the wrapper inherits from the `<pre>` it replaces.
1659
+ *
1660
+ * The splice is the same shape of problem `rehypeVantageMathStamps` solves for
1661
+ * KaTeX: the pipeline stamped the fence, and swapping the element out throws
1662
+ * the stamps away. A mermaid diagram inside a toned section then drew no slice
1663
+ * of the section's vertical rule, leaving a hole as tall as the diagram; a
1664
+ * collapsed section left the diagram visible under a closed heading; and a
1665
+ * `#L` anchor pointing at the fence resolved to nothing.
1666
+ *
1667
+ * Named individually rather than copied wholesale: `class` is the caller's
1668
+ * (`className`), and `id` would be duplicated onto a second element.
1669
+ */
1670
+ const CARRIED_ATTRIBUTES = [
1671
+ "data-source-line",
1672
+ "data-vantage-tone",
1673
+ "data-vantage-emphasis",
1674
+ "data-vantage-run",
1675
+ "data-vantage-collapsed",
1676
+ "data-vantage-collapse-group"
1677
+ ];
1519
1678
  function replaceWithSvg(preEl, svg, className) {
1520
1679
  const wrapper = document.createElement("div");
1521
1680
  wrapper.className = className;
1681
+ for (const name of CARRIED_ATTRIBUTES) {
1682
+ const value = preEl.getAttribute(name);
1683
+ if (value !== null) wrapper.setAttribute(name, value);
1684
+ }
1522
1685
  wrapper.innerHTML = svg;
1523
1686
  preEl.replaceWith(wrapper);
1524
1687
  }
@@ -1685,6 +1848,8 @@ The steps below predate the rewrite.
1685
1848
  - **Anything outside those sets is silently ignored** — nothing breaks, and nothing styles either. Run \`vantage-check\` on the document: the \`vantage/*\` rules are the only thing that will ever tell you a directive did nothing.
1686
1849
  - **Always close the comment with \`-->\`.** Never \`--!>\`, and never leave it open: Markdown reads every line below an unclosed \`<!--\` as part of the comment, and the whole rest of the document vanishes from the page. For the same reason \`-->\` cannot appear *inside* a value — it ends the comment early and spills the remainder into the page as literal text.
1687
1850
  - **In a list, indent the directive inside the item**, with blank lines around it (below). At the start of a line between two items it ends the list and starts a second one, which changes the numbering and the spacing in every renderer — the one thing a directive must never do.
1851
+ - **An open question's id is \`OQ-\` then an optional short uppercase prefix then digits** — \`OQ-9\`, \`OQ-TP6\`, \`OQ-A03\`. The prefix is what keeps ids distinct once one document references another's questions, so use one in both whenever they cross-reference. \`vantage-check\` reports anything outside that shape as \`vantage/oq-id-format\`, and the same id twice in one document as \`vantage/oq-id-duplicate\` — both are silent otherwise, because the id becomes the block's anchor and a refused or duplicated one simply goes nowhere.
1852
+ - **A reference is a link, or it is a lie.** An \`OQ-\` id, a \`\u00a7N\` section number and a filename all read like pointers, and written as bare prose none of them can be followed or checked — which is exactly why a stale one is never caught. Link the question to its anchor (\`[OQ-4](#OQ-4)\`, or the Decision Ledger once it is compacted), the section to its heading, the filename to the file. \`vantage-check\` reports all three (\`ref/*\`) as errors, and checks that the link points at the thing the reference names rather than merely at something. Writing a specimen rather than a reference? Put it in a fenced block, which the rules never read.
1688
1853
  - **Every open question (\u{1F4AC}) with a stated leaning gets an \`oq\` directive.** The convention's prose — the emoji, the \`OQ-N\` id, the \`_Leaning:_\` line, the fill-in \`**Answer:**\` — produces no button on its own. Writing the convention and stopping there is the most common way this feature goes missing: the questions look complete, review mode is on, and there is nothing to click. **\`vantage-check\` reports it as an error** (\`vantage/oq-missing\`), because a question awaiting a ruling that the reviewer cannot file is not a style preference. Mark it \u{1F512} if it is blocked on something upstream and cannot be answered yet, or \u2705 once it is decided; either state needs no directive.
1689
1854
  - **A \`leaning\` restates the leaning; it is never "yes".** The one-click button in review mode files that text as a review comment, and the comment is all the agent reading it has — nobody remembers which button was clicked. \`leaning="Yes"\` beside a two-branch question is a support ticket.
1690
1855
 
@@ -1703,6 +1868,6 @@ The steps below predate the rewrite.
1703
1868
  - Single dollars are **not** math delimiters: \`$HOME\` and \`$100\` stay literal, so prose and shell snippets are safe to write as-is.
1704
1869
  `;
1705
1870
  //#endregion
1706
- export { ALERT_TITLES, DIRECTIVE_NAMES, DIRECTIVE_VOCABULARY, DOC_STATUSES, DOC_STATUS_TONES, SAFE_STYLE, STYLE_GUIDE, VANTAGE_ALERTS, VANTAGE_BADGES, VANTAGE_COLLAPSED, VANTAGE_EMPHASIS, VANTAGE_FRONTMATTER_KEYS, VANTAGE_OQ_HOST_TARGETS, VANTAGE_RUNS, VANTAGE_SENTINEL, VANTAGE_TONES, buildPipeline, buildRemarkPlugins, clearLineAnchorHighlights, hasVantageSentinel, isDocStatus, parseFrontmatter, parseLineAnchor, parseVantageDirective, readVantageFrontmatter, rehypeSourceLines, rehypeVantageAlerts, rehypeVantageDirectives, renderMarkdown, renderMermaidBlocks, resolveLinks, sanitizeSchema, scrollToLineAnchor };
1871
+ export { ALERT_TITLES, DIRECTIVE_NAMES, DIRECTIVE_VOCABULARY, DOC_STATUSES, DOC_STATUS_TONES, SAFE_STYLE, STYLE_GUIDE, VANTAGE_ALERTS, VANTAGE_BADGES, VANTAGE_COLLAPSED, VANTAGE_EMPHASIS, VANTAGE_FRONTMATTER_KEYS, VANTAGE_OQ_HOST_TARGETS, VANTAGE_RUNS, VANTAGE_SENTINEL, VANTAGE_TONES, buildPipeline, buildRemarkPlugins, clearLineAnchorHighlights, hasVantageSentinel, isDocStatus, parseFrontmatter, parseLineAnchor, parseVantageDirective, readVantageFrontmatter, rehypeSourceLines, rehypeVantageAlerts, rehypeVantageAnchors, rehypeVantageDirectives, renderMarkdown, renderMermaidBlocks, resolveLinks, sanitizeSchema, scrollToLineAnchor };
1707
1872
 
1708
1873
  //# sourceMappingURL=index.js.map