Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@
"@dhlx/vitepress-plugin-drawio": "^0.0.10",
"@panzoom/panzoom": "^4.6.2",
"@types/node": "^25.6.2",
"@vueuse/core": "^12.4.0",
"@vueuse/integrations": "^12.4.0",
"gray-matter": "4.0.3",
"linkedom": "0.18.13",
"mark.js": "8.11.1",
"markdown-it-mathjax3": "^4.3.2",
"mermaid": "^10.9.6",
"pagedjs": "0.4.3",
Expand Down
10 changes: 10 additions & 0 deletions pnpm-lock.yaml

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

5 changes: 4 additions & 1 deletion site/.vitepress/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { defineConfig } from 'vitepress'
import withDrawio from '@dhlx/vitepress-plugin-drawio'
import { navEn } from './nav'
import { buildSidebar } from './sidebar'
import { sharedThemeConfig, sharedMarkdown, makeSocialLinks } from './shared'
import { sharedThemeConfig, sharedMarkdown, makeSocialLinks, localSearchBoxAlias } from './shared'
import { createReadStream, existsSync } from 'node:fs'
import { join, normalize } from 'node:path'
import { fileURLToPath } from 'node:url'
Expand Down Expand Up @@ -35,6 +35,9 @@ function serveCodeExamplesInDev() {
export default withDrawio(defineConfig({
vite: {
plugins: [serveCodeExamplesInDev()],
resolve: {
alias: localSearchBoxAlias,
},
ssr: {
// mermaid / @panzoom/panzoom 都只在客户端 onMounted 后动态 import 求值,
// SSR 阶段不能也不应打包求值(mermaid 访问 document、panzoom 访问 DOM)。
Expand Down
13 changes: 13 additions & 0 deletions site/.vitepress/config/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ export const sharedMarkdown = {
},
}

// 覆盖 vitepress 内置搜索盒:VPLocalSearchBox 只被 VPNavBarSearch 以
// './VPLocalSearchBox.vue' 这一 specifier 引用,alias 指到我们的覆盖版
// (索引构建+查询挪进 Web Worker,修 issue #156 的搜索卡顿)。
// index.ts(dev/单体 build)与 sharedBase(分卷构建)都要用,单一来源防漏改。
export const localSearchBoxAlias = {
'./VPLocalSearchBox.vue': fileURLToPath(
new URL('../theme/components/VPLocalSearchBox.vue', import.meta.url)
),
}

export const sharedBase = {
base: '/Tutorial_AwesomeModernCPP/',
cleanUrls: true,
Expand All @@ -54,6 +64,9 @@ export const sharedBase = {
},

vite: {
resolve: {
alias: localSearchBoxAlias,
},
build: {
chunkSizeWarningLimit: 5000,
},
Expand Down
Loading
Loading