vantage-md 0.1.3 → 0.5.4

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/README.md CHANGED
@@ -73,18 +73,33 @@ function Docs({ content, path }) {
73
73
 
74
74
  The React component includes mermaid diagram rendering (lazy-loaded), frontmatter display, and syntax highlighting out of the box.
75
75
 
76
- ### Rehype plugin (bring your own pipeline)
76
+ ### Your own processor, Vantage's chain
77
+
78
+ `buildPipeline` returns the exact remark and rehype lists `renderMarkdown` and
79
+ the React viewer use, in the exact order — including the sanitiser schema, and
80
+ `rehypeSlug` after it, which is what keeps generated heading ids free of
81
+ `rehype-sanitize`'s `user-content-` prefix. Use it rather than assembling the
82
+ chain yourself; that is how a document ends up rendering differently in two
83
+ places.
77
84
 
78
85
  ```typescript
79
- import { rehypeSourceLines } from "vantage-md";
86
+ import { buildPipeline } from "vantage-md";
87
+
88
+ const { remarkPlugins, rehypePlugins } = buildPipeline({ bodyLineOffset: 0 });
80
89
 
81
90
  const processor = unified()
82
91
  .use(remarkParse)
83
- .use(remarkRehype)
84
- .use(rehypeSourceLines) // adds data-source-line to block elements
92
+ .use(remarkPlugins)
93
+ .use(remarkRehype, { allowDangerousHtml: true })
94
+ .use(rehypePlugins)
85
95
  .use(rehypeStringify);
86
96
  ```
87
97
 
98
+ Every plugin is toggleable (`gfm`, `math`, `highlight`, `sourceLines`,
99
+ `sanitize`), and `buildRemarkPlugins` returns the mdast half alone for tools
100
+ that parse without rendering. `rehypeSourceLines` is still exported on its own
101
+ if all you want is `data-source-line`.
102
+
88
103
  ### Svelte / Vue / plain HTML
89
104
 
90
105
  ```svelte
@@ -103,18 +118,18 @@ const processor = unified()
103
118
 
104
119
  | Entry point | Description |
105
120
  |-------------|-------------|
106
- | `vantage-md` | `renderMarkdown`, `rehypeSourceLines`, `scrollToLineAnchor`, `parseLineAnchor`, `parseFrontmatter`, `sanitizeSchema` |
107
- | `vantage-md/react` | `MarkdownViewer`, `useLineAnchor`, `MermaidDiagram`, `FrontmatterDisplay` + all core exports |
108
- | `vantage-md/styles` | Line-anchor highlight CSS (light + dark mode) |
121
+ | `vantage-md` | `renderMarkdown`, `buildPipeline`, `buildRemarkPlugins`, `rehypeSourceLines`, `scrollToLineAnchor`, `parseLineAnchor`, `parseFrontmatter`, `readVantageFrontmatter`, `sanitizeSchema` |
122
+ | `vantage-md/react` | `MarkdownViewer`, `useLineAnchor`, `MermaidDiagram`, `FrontmatterDisplay`, `DocumentStatusChip` + all core exports |
123
+ | `vantage-md/styles` | Line-anchor highlight CSS, plus the theme layer for the `data-vantage-*` directive attributes and the chrome chips (light + dark mode) |
109
124
 
110
125
  ## Features
111
126
 
112
127
  - **Line anchors** — `data-source-line` attributes on every block element, with scroll/highlight utilities
113
128
  - **GFM** — tables, strikethrough, task lists, autolinks
114
- - **KaTeX** — `$$...$$` math blocks
129
+ - **KaTeX** — `$$...$$` math, inline and block (single `$` is not a delimiter, so `$HOME` and `$100` stay literal)
115
130
  - **Mermaid** — diagram rendering (client-side, lazy-loaded)
116
131
  - **Syntax highlighting** — via highlight.js
117
- - **Frontmatter** — YAML (`---`) and TOML (`+++`) parsing
132
+ - **Frontmatter** — YAML (`---`) and TOML (`+++`) parsing. A reserved `vantage:` key carries file-scoped chrome: `status-chip: true` makes `FrontmatterDisplay` render the document's `status:` as a chip above the metadata card, and the reserved key itself is never shown as a metadata row
118
133
  - **Sanitization** — XSS-safe with allowlisted KaTeX/MathML elements
119
134
  - **Dark mode** — all styles support `.dark` class
120
135