You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(v0.3.0): add Shiki, Docusaurus, and Starlight companion plugins
Three new subpath exports built on top of the core plugin's AST output:
- remark-code-region/shiki — injects [!code highlight]/[!code focus]
annotations from ?highlight= and ?focus= flags, with language-aware
comment syntax (# for Python/Bash/Ruby, // for JS/Rust/Go, -- for
SQL/Lua, /* */ for CSS, <!-- --> for HTML). Optional diffStepStyle:
'highlight' converts diff-step ++/-- markers into softer highlight
emphasis. Shiki transformers only recognize annotations inside
language-valid comments, so the language map is essential.
- remark-code-region/docusaurus — turns tabGroup wrapper nodes into
<Tabs>/<TabItem> MDX JSX with automatic import injection.
- remark-code-region/starlight — turns tabGroup wrapper nodes into
Starlight <Tabs>/<TabItem> components with syncKey support.
Core changes:
- parseFlags() extracts highlight=/focus= and stores raw specs on
node.data for companion plugins to consume.
- New scripts/build.mjs replaces the inline esbuild command and
builds 4 CJS bundles in parallel.
- CI smoke-tests all 4 CJS bundles.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: .github/workflows/ci.yml
+6-2Lines changed: 6 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -29,8 +29,12 @@ jobs:
29
29
- name: Build
30
30
run: npm run build
31
31
32
-
- name: Verify CJS bundle
33
-
run: node -e "const p = require('./index.cjs'); if (typeof p !== 'function') { console.error('CJS export is not a function:', typeof p); process.exit(1); }"
32
+
- name: Verify CJS bundles
33
+
run: |
34
+
node -e "const p = require('./index.cjs'); if (typeof p !== 'function') { console.error('CJS export is not a function:', typeof p); process.exit(1); }"
35
+
node -e "const p = require('./lib/docusaurus.cjs'); if (typeof p !== 'function') { console.error('CJS export is not a function:', typeof p); process.exit(1); }"
36
+
node -e "const p = require('./lib/starlight.cjs'); if (typeof p !== 'function') { console.error('CJS export is not a function:', typeof p); process.exit(1); }"
37
+
node -e "const p = require('./lib/shiki.cjs'); if (typeof p !== 'function') { console.error('CJS export is not a function:', typeof p); process.exit(1); }"
Copy file name to clipboardExpand all lines: README.md
+68-3Lines changed: 68 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -430,7 +430,60 @@ To split adjacent tab groups without visible content between them, use an HTML c
430
430
431
431
The plugin emits `tabGroup` wrapper nodes with `data.hName = 'div'` and `data.hProperties.class = 'code-tabs'` (customizable via `tabGroupClass` option). Each child code node gets `data.tabLabel` and `data.hProperties['data-tab']`.
432
432
433
-
Without a companion plugin, this renders as a `<div class="code-tabs">` wrapping stacked `<pre><code>` blocks. Framework-specific companion plugins (coming soon) will transform these into native Docusaurus `<Tabs>`, Starlight tabs, etc.
433
+
Without a companion plugin, this renders as a `<div class="code-tabs">` wrapping stacked `<pre><code>` blocks. Add a companion plugin to transform these into native framework tabs:
For other remark pipelines, the `tabGroup` AST nodes are well-structured for custom rehype plugins to consume directly.
452
+
453
+
## Shiki annotations
454
+
455
+
Add `?highlight=` or `?focus=` to any reference to inject [Shiki transformer annotations](https://shiki.style/packages/transformers) into the extracted code:
Requires `@shikijs/transformers` (`transformerNotationHighlight`, `transformerNotationFocus`) configured in your Shiki setup.
477
+
478
+
### Soft diff-step highlighting
479
+
480
+
By default, `diff-step` emits `// [!code ++]` / `// [!code --]` for green/red diff highlighting. The Shiki companion can convert these to softer `// [!code highlight]` annotations — emphasizing new lines without the diff color scheme:
0 commit comments