Skip to content

Commit fccc617

Browse files
authored
feat(markdown): expose Shiki color replacements in markdown options (#5153)
1 parent 6dd3632 commit fccc617

File tree

8 files changed

+824
-810
lines changed

8 files changed

+824
-810
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { highlight } from 'node/markdown/plugins/highlight'
2+
3+
describe('node/markdown/plugins/highlight', () => {
4+
test('passes color replacements through markdown options', async () => {
5+
const [render, dispose] = await highlight(
6+
{ light: 'github-light', dark: 'github-dark' },
7+
{
8+
colorReplacements: {
9+
'github-light': {
10+
'#005cc5': '#000000'
11+
}
12+
}
13+
}
14+
)
15+
16+
try {
17+
const html = await render('const a = 1', 'js', '')
18+
19+
expect(html).toContain('--shiki-light:#000000')
20+
expect(html).toContain('--shiki-dark:#79B8FF')
21+
expect(html).not.toContain('--shiki-light:#005CC5')
22+
} finally {
23+
dispose()
24+
}
25+
})
26+
})

docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616
"postcss-rtlcss": "^5.7.1",
1717
"vitepress": "workspace:*",
1818
"vitepress-plugin-group-icons": "^1.7.1",
19-
"vitepress-plugin-llms": "^1.11.0"
19+
"vitepress-plugin-llms": "^1.11.1"
2020
}
2121
}

docs/snippets/init.ansi

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
┌ Welcome to VitePress!
22
│
3-
◇ Where should VitePress initialize the config?
4-
│ ./docs
3+
◇ Where should VitePress initialize the config?
4+
│ ./docs
55
│
6-
◇ Where should VitePress look for your markdown files?
7-
│ ./docs
6+
◇ Where should VitePress look for your markdown files?
7+
│ ./docs
88
│
9-
◇ Site title:
10-
│ My Awesome Project
9+
◇ Site title:
10+
│ My Awesome Project
1111
│
12-
◇ Site description:
13-
│ A VitePress Site
12+
◇ Site description:
13+
│ A VitePress Site
1414
│
15-
◇ Theme:
16-
│ Default Theme
15+
◇ Theme:
16+
│ Default Theme
1717
│
18-
◇ Use TypeScript for config and theme files?
19-
│ Yes
18+
◇ Use TypeScript for config and theme files?
19+
│ Yes
2020
│
21-
◇ Add VitePress npm scripts to package.json?
22-
│ Yes
21+
◇ Add VitePress npm scripts to package.json?
22+
│ Yes
2323
│
24-
◇ Add a prefix for VitePress npm scripts?
25-
│ Yes
24+
◇ Add a prefix for VitePress npm scripts?
25+
│ Yes
2626
│
27-
◇ Prefix for VitePress npm scripts:
28-
│ docs
27+
◇ Prefix for VitePress npm scripts:
28+
│ docs
2929
│
30-
└ Done! Now run pnpm run docs:dev and start writing.
30+
└ Done! Now run pnpm run docs:dev and start writing.

package.json

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -96,28 +96,28 @@
9696
"*": "prettier --experimental-cli --ignore-unknown --write"
9797
},
9898
"dependencies": {
99-
"@docsearch/css": "^4.5.3",
100-
"@docsearch/js": "^4.5.3",
101-
"@docsearch/sidepanel-js": "^4.5.3",
102-
"@iconify-json/simple-icons": "^1.2.69",
103-
"@shikijs/core": "^3.22.0",
104-
"@shikijs/transformers": "^3.22.0",
105-
"@shikijs/types": "^3.22.0",
99+
"@docsearch/css": "^4.6.0",
100+
"@docsearch/js": "^4.6.0",
101+
"@docsearch/sidepanel-js": "^4.6.0",
102+
"@iconify-json/simple-icons": "^1.2.74",
103+
"@shikijs/core": "^4.0.2",
104+
"@shikijs/transformers": "^4.0.2",
105+
"@shikijs/types": "^4.0.2",
106106
"@types/markdown-it": "^14.1.2",
107-
"@vitejs/plugin-vue": "^6.0.4",
108-
"@vue/devtools-api": "^8.0.5",
109-
"@vue/shared": "^3.5.27",
110-
"@vueuse/core": "^14.2.0",
111-
"@vueuse/integrations": "^14.2.0",
107+
"@vitejs/plugin-vue": "^6.0.5",
108+
"@vue/devtools-api": "^8.1.0",
109+
"@vue/shared": "^3.5.30",
110+
"@vueuse/core": "^14.2.1",
111+
"@vueuse/integrations": "^14.2.1",
112112
"focus-trap": "^8.0.0",
113113
"mark.js": "8.11.1",
114114
"minisearch": "^7.2.0",
115-
"shiki": "^3.22.0",
115+
"shiki": "^4.0.2",
116116
"vite": "^7.3.1",
117-
"vue": "^3.5.27"
117+
"vue": "^3.5.30"
118118
},
119119
"devDependencies": {
120-
"@clack/prompts": "^1.0.0",
120+
"@clack/prompts": "^1.1.0",
121121
"@iconify/utils": "^3.1.0",
122122
"@mdit-vue/plugin-component": "^3.0.2",
123123
"@mdit-vue/plugin-frontmatter": "^3.0.2",
@@ -128,7 +128,7 @@
128128
"@mdit-vue/shared": "^3.0.2",
129129
"@polka/compression": "^1.0.0-next.28",
130130
"@rollup/plugin-alias": "^6.0.0",
131-
"@rollup/plugin-commonjs": "^29.0.0",
131+
"@rollup/plugin-commonjs": "^29.0.2",
132132
"@rollup/plugin-json": "^6.1.0",
133133
"@rollup/plugin-node-resolve": "^16.0.3",
134134
"@rollup/plugin-replace": "^6.0.3",
@@ -140,58 +140,58 @@
140140
"@types/markdown-it-container": "^4.0.0",
141141
"@types/markdown-it-emoji": "^3.0.1",
142142
"@types/minimist": "^1.2.5",
143-
"@types/node": "^25.2.0",
143+
"@types/node": "^25.5.0",
144144
"@types/picomatch": "^4.0.2",
145145
"@types/prompts": "^2.4.9",
146-
"chokidar": "^4.0.3",
147-
"conventional-changelog": "^7.1.1",
148-
"conventional-changelog-angular": "^8.1.0",
146+
"chokidar": "^5.0.0",
147+
"conventional-changelog": "^7.2.0",
148+
"conventional-changelog-angular": "^8.3.0",
149149
"cross-spawn": "^7.0.6",
150-
"esbuild": "^0.27.2",
150+
"esbuild": "^0.27.4",
151151
"execa": "^9.6.1",
152-
"fs-extra": "^11.3.3",
152+
"fs-extra": "^11.3.4",
153153
"get-port": "^7.1.0",
154154
"gray-matter": "^4.0.3",
155-
"lint-staged": "^16.2.7",
155+
"lint-staged": "^16.4.0",
156156
"lodash.template": "^4.5.0",
157-
"lru-cache": "^11.2.5",
158-
"markdown-it": "^14.1.0",
157+
"lru-cache": "^11.2.7",
158+
"markdown-it": "^14.1.1",
159159
"markdown-it-anchor": "^9.2.0",
160160
"markdown-it-async": "^2.2.0",
161161
"markdown-it-attrs": "^4.3.1",
162-
"markdown-it-cjk-friendly": "^2.0.1",
162+
"markdown-it-cjk-friendly": "^2.0.2",
163163
"markdown-it-container": "^4.0.0",
164164
"markdown-it-emoji": "^3.0.0",
165165
"markdown-it-mathjax3": "^4.3.2",
166166
"minimist": "^1.2.8",
167-
"nanoid": "^5.1.6",
167+
"nanoid": "^5.1.7",
168168
"obug": "^2.1.1",
169-
"ora": "^9.1.0",
169+
"ora": "^9.3.0",
170170
"oxc-minify": "^0.98.0",
171171
"p-map": "^7.0.4",
172172
"package-directory": "^8.2.0",
173173
"path-to-regexp": "^6.3.0",
174174
"picocolors": "^1.1.1",
175175
"picomatch": "^4.0.3",
176-
"playwright-chromium": "^1.58.1",
176+
"playwright-chromium": "^1.58.2",
177177
"polka": "^1.0.0-next.28",
178178
"postcss": "^8.5.6",
179179
"postcss-selector-parser": "^7.1.1",
180180
"prettier": "^3.8.1",
181181
"prompts": "^2.4.2",
182182
"punycode": "^2.3.1",
183-
"rollup": "^4.57.1",
183+
"rollup": "^4.59.0",
184184
"rollup-plugin-dts": "6.1.1",
185185
"rollup-plugin-esbuild": "^6.2.1",
186-
"semver": "^7.7.3",
186+
"semver": "^7.7.4",
187187
"simple-git-hooks": "^2.13.1",
188188
"sirv": "^3.0.2",
189-
"sitemap": "^9.0.0",
189+
"sitemap": "^9.0.1",
190190
"tinyglobby": "^0.2.15",
191191
"typescript": "^5.9.3",
192192
"vitest": "4.0.0-beta.4",
193-
"vue-tsc": "^3.2.4",
194-
"wait-on": "^9.0.3"
193+
"vue-tsc": "^3.2.6",
194+
"wait-on": "^9.0.4"
195195
},
196196
"peerDependencies": {
197197
"markdown-it-mathjax3": "^4",
@@ -209,5 +209,5 @@
209209
"optional": true
210210
}
211211
},
212-
"packageManager": "pnpm@10.28.2"
212+
"packageManager": "pnpm@10.32.1"
213213
}

0 commit comments

Comments
 (0)