Merge pull request #859 from vuejs/main

pull/1136/head
Divyansh Singh 3 years ago committed by GitHub
commit 7ad269d806
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -64,6 +64,13 @@ export interface UserConfig<ThemeConfig = any> {
* @experimental
*/
mpa?: boolean
/**
* Don't fail builds due to dead links.
*
* @default false
*/
ignoreDeadLinks?: boolean
}
export type RawConfigExports<ThemeConfig = any> =
@ -74,7 +81,13 @@ export type RawConfigExports<ThemeConfig = any> =
export interface SiteConfig<ThemeConfig = any>
extends Pick<
UserConfig,
'markdown' | 'vue' | 'vite' | 'shouldPreload' | 'mpa' | 'lastUpdated'
| 'markdown'
| 'vue'
| 'vite'
| 'shouldPreload'
| 'mpa'
| 'lastUpdated'
| 'ignoreDeadLinks'
> {
root: string
srcDir: string
@ -152,7 +165,8 @@ export async function resolveConfig(
vue: userConfig.vue,
vite: userConfig.vite,
shouldPreload: userConfig.shouldPreload,
mpa: !!userConfig.mpa
mpa: !!userConfig.mpa,
ignoreDeadLinks: userConfig.ignoreDeadLinks
}
return config

@ -61,7 +61,7 @@ export const createMarkdownRenderer = async (
const md = MarkdownIt({
html: true,
linkify: true,
highlight: await highlight(options.theme),
highlight: options.highlight || (await highlight(options.theme)),
...options
}) as MarkdownRenderer

@ -44,7 +44,8 @@ export async function createVitePressPlugin(
site,
vue: userVuePluginOptions,
vite: userViteConfig,
pages
pages,
ignoreDeadLinks
} = siteConfig
let markdownToVue: Awaited<ReturnType<typeof createMarkdownToVueRenderFn>>
@ -153,7 +154,7 @@ export async function createVitePressPlugin(
},
renderStart() {
if (hasDeadLinks) {
if (hasDeadLinks && !ignoreDeadLinks) {
throw new Error(`One or more pages contain dead links.`)
}
},

Loading…
Cancel
Save