Skip to content

Commit 10de041

Browse files
committed
docs: highlight code with Shiki vitesse-light/vitesse-dark themes
1 parent f7a096f commit 10de041

6 files changed

Lines changed: 35 additions & 1 deletion

File tree

docs/nuxt.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import process from 'node:process'
2+
import { fileURLToPath } from 'node:url'
23

34
export default defineNuxtConfig({
45
compatibilityDate: '2026-08-21',
@@ -9,6 +10,12 @@ export default defineNuxtConfig({
910

1011
css: ['~/assets/css/devframe.css'],
1112

13+
// Redirect the layer's rangi highlighter import to a shim that renders code
14+
// with Shiki's vitesse-light / vitesse-dark themes.
15+
alias: {
16+
'comark/plugins/rangi': fileURLToPath(new URL('./shims/rangi.ts', import.meta.url)),
17+
},
18+
1219
site: {
1320
url: 'https://devfra.me',
1421
name: 'Devframe',

docs/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"docs:serve": "nuxt preview"
99
},
1010
"dependencies": {
11+
"@shikijs/themes": "catalog:docs",
1112
"comark-docs": "catalog:docs",
1213
"nuxt": "catalog:build",
1314
"ufo": "catalog:deps"

docs/shims/rangi.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import vitesseDark from '@shikijs/themes/vitesse-dark'
2+
import vitesseLight from '@shikijs/themes/vitesse-light'
3+
import shiki from 'comark/plugins/shiki'
4+
5+
// Aliased over `comark/plugins/rangi` (see `nuxt.config.ts` → `alias`) so the
6+
// comark-docs layer's content pipeline highlights code with Shiki's
7+
// vitesse-light / vitesse-dark themes instead of rangi + GitHub themes.
8+
// The layer calls this with a rangi `{ theme }` option we intentionally ignore.
9+
export default function rangiToShiki(_options?: unknown) {
10+
return shiki({
11+
registerDefaultThemes: false,
12+
themes: { light: vitesseLight, dark: vitesseDark },
13+
})
14+
}

knip.jsonc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,12 @@
4040
// Nuxt auto-registers `app/components` and `app/composables`; the files
4141
// here shadow same-named pieces of the comark-docs layer (AppHeaderBrand,
4242
// useFilteredNavigation, ...), so nothing imports them explicitly.
43-
"entry": ["app/components/*.vue", "app/composables/*.ts"]
43+
// `shims/rangi.ts` is wired in through `nuxt.config.ts`'s `alias`.
44+
"entry": ["app/components/*.vue", "app/composables/*.ts", "shims/*.ts"],
45+
// `comark` is the comark-docs layer's own (pkg.pr.new pinned) dep; the
46+
// rangi->shiki shim imports `comark/plugins/shiki` from it, resolved
47+
// through the workspace's hoisted store.
48+
"ignoreDependencies": ["comark"]
4449
},
4550
"examples/hub-next": {
4651
// The React client build's root sits at `src/client` (`next dev

pnpm-lock.yaml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ catalogs:
128128
zigpty: ^0.2.1
129129
zod: ^4.4.3
130130
docs:
131+
'@shikijs/themes': ^4.4.3
131132
comark-docs: github:comarkdown/comark-docs
132133
frontend:
133134
'@antfu/design': ^0.3.4

0 commit comments

Comments
 (0)