@vmz/plugin-shiki 0.3.7 → 0.3.8

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.
Files changed (2) hide show
  1. package/dist/runtime.js +12 -0
  2. package/package.json +3 -3
package/dist/runtime.js CHANGED
@@ -3,6 +3,16 @@
3
3
  * TextMate grammar via configurable peer (default `vmz-textmate/shiki`).
4
4
  */
5
5
  const DEFAULT_TEXTMATE = 'vmz-textmate/shiki';
6
+ /**
7
+ * Shiki writes `background-color` and `color` inline on `<pre>`, which makes
8
+ * the site stylesheet need `!important` to own code surfaces. Strip that
9
+ * inline style so the theme tokens stay the single source of colour.
10
+ */
11
+ const stripPreInlineStyle = {
12
+ pre(node) {
13
+ delete node.properties.style;
14
+ },
15
+ };
6
16
  let config = {};
7
17
  let configResolved = false;
8
18
  let cached = null;
@@ -119,6 +129,7 @@ export async function highlight(code, lang = 'text', theme = 'vitesse-dark') {
119
129
  return highlighter.codeToHtml(code ?? '', {
120
130
  lang: lang || 'text',
121
131
  theme,
132
+ transformers: [stripPreInlineStyle],
122
133
  });
123
134
  }
124
135
  catch {
@@ -133,6 +144,7 @@ export function highlightSync(code, lang = 'text', theme = 'vitesse-dark') {
133
144
  return cached.codeToHtml(code ?? '', {
134
145
  lang: lang || 'text',
135
146
  theme,
147
+ transformers: [stripPreInlineStyle],
136
148
  });
137
149
  }
138
150
  catch {
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "dependencies": {
3
- "@vmz/plugin": "0.3.7"
3
+ "@vmz/plugin": "0.3.8"
4
4
  },
5
5
  "description": "VMZ Shiki adapter - <Shiki> + code engine registration",
6
6
  "devDependencies": {
7
7
  "@types/node": "^22.15.0",
8
8
  "shiki": "^3.12.2",
9
9
  "typescript": "^5.8.3",
10
- "vmz-textmate": "0.3.7"
10
+ "vmz-textmate": "0.3.8"
11
11
  },
12
12
  "engines": {
13
13
  "node": ">=24.12.0"
@@ -61,5 +61,5 @@
61
61
  },
62
62
  "type": "module",
63
63
  "types": "./dist/vmz.plugin.d.ts",
64
- "version": "0.3.7"
64
+ "version": "0.3.8"
65
65
  }