Skip to content

Commit 7ad269d

Browse files
authored
Merge pull request #859 from vuejs/main
2 parents 7787bbe + 19b0758 commit 7ad269d

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

src/node/config.ts

+16-2
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ export interface UserConfig<ThemeConfig = any> {
6464
* @experimental
6565
*/
6666
mpa?: boolean
67+
68+
/**
69+
* Don't fail builds due to dead links.
70+
*
71+
* @default false
72+
*/
73+
ignoreDeadLinks?: boolean
6774
}
6875

6976
export type RawConfigExports<ThemeConfig = any> =
@@ -74,7 +81,13 @@ export type RawConfigExports<ThemeConfig = any> =
7481
export interface SiteConfig<ThemeConfig = any>
7582
extends Pick<
7683
UserConfig,
77-
'markdown' | 'vue' | 'vite' | 'shouldPreload' | 'mpa' | 'lastUpdated'
84+
| 'markdown'
85+
| 'vue'
86+
| 'vite'
87+
| 'shouldPreload'
88+
| 'mpa'
89+
| 'lastUpdated'
90+
| 'ignoreDeadLinks'
7891
> {
7992
root: string
8093
srcDir: string
@@ -152,7 +165,8 @@ export async function resolveConfig(
152165
vue: userConfig.vue,
153166
vite: userConfig.vite,
154167
shouldPreload: userConfig.shouldPreload,
155-
mpa: !!userConfig.mpa
168+
mpa: !!userConfig.mpa,
169+
ignoreDeadLinks: userConfig.ignoreDeadLinks
156170
}
157171

158172
return config

src/node/markdown/markdown.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export const createMarkdownRenderer = async (
6161
const md = MarkdownIt({
6262
html: true,
6363
linkify: true,
64-
highlight: await highlight(options.theme),
64+
highlight: options.highlight || (await highlight(options.theme)),
6565
...options
6666
}) as MarkdownRenderer
6767

src/node/plugin.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ export async function createVitePressPlugin(
4444
site,
4545
vue: userVuePluginOptions,
4646
vite: userViteConfig,
47-
pages
47+
pages,
48+
ignoreDeadLinks
4849
} = siteConfig
4950

5051
let markdownToVue: Awaited<ReturnType<typeof createMarkdownToVueRenderFn>>
@@ -153,7 +154,7 @@ export async function createVitePressPlugin(
153154
},
154155

155156
renderStart() {
156-
if (hasDeadLinks) {
157+
if (hasDeadLinks && !ignoreDeadLinks) {
157158
throw new Error(`One or more pages contain dead links.`)
158159
}
159160
},

0 commit comments

Comments
 (0)