Skip to content

Commit

Permalink
refactor(docs): migrate twoslash for vitepress
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed Jul 23, 2024
1 parent 17d3efd commit e2b9ca1
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 108 deletions.
2 changes: 1 addition & 1 deletion docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import MarkdownItGitHubAlerts from 'markdown-it-github-alerts'
import { defineConfig } from 'vitepress'

import { transformerTwoslash } from 'vitepress-plugin-twoslash'
import { transformerTwoslash } from '@shikijs/vitepress-twoslash'
import { repositoryMeta } from './data/meta'
import { description, ogImage, title } from './constance'

Expand Down
7 changes: 4 additions & 3 deletions docs/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
import { h } from 'vue'
import type { EnhanceAppContext } from 'vitepress'
import DefaultTheme from 'vitepress/theme'
import TwoSlashFloatingVue from 'vitepress-plugin-twoslash/client'
import TwoslashFloatingVue from '@shikijs/vitepress-twoslash/client'
import CustomLayout from './CustomLayout.vue'

import 'vitepress-plugin-twoslash/style.css'
import '@shikijs/vitepress-twoslash/style.css'
import 'uno.css'
import './style.css'

Expand All @@ -15,6 +15,7 @@ export default {
return h(CustomLayout)
},
enhanceApp({ app }: EnhanceAppContext) {
app.use(TwoSlashFloatingVue as any)
// @ts-expect-error type bug
app.use(TwoslashFloatingVue)
},
}
4 changes: 0 additions & 4 deletions docs/.vitepress/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,4 @@ export default defineConfig({
Unocss(fileURLToPath(new URL('./uno.config.ts', import.meta.url))),
Icons(),
],
// https://github.com/antfu/shikiji/issues/86
ssr: {
noExternal: ['shikiji-twoslash', 'vitepress-plugin-twoslash'],
},
})
7 changes: 2 additions & 5 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@
"lint": "eslint . && case-police '**/*.md'"
},
"devDependencies": {
"@iconify-json/heroicons": "^1.1.22",
"@iconify-json/lucide": "^1.1.201",
"@iconify-json/radix-icons": "^1.1.14",
"@iconify-json/simple-icons": "^1.1.109",
"@iconify/json": "^2.2.230",
"@shikijs/vitepress-twoslash": "^1.11.0",
"case-police": "^0.6.1",
"consola": "^3.2.3",
"dotenv": "^16.4.5",
Expand All @@ -29,7 +27,6 @@
"unplugin-icons": "^0.19.0",
"unplugin-vue-components": "^0.27.3",
"vitepress": "^1.3.1",
"vitepress-plugin-twoslash": "^0.10.2",
"vue": "^3.4.33"
}
}
155 changes: 60 additions & 95 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e2b9ca1

Please sign in to comment.