File tree 3 files changed +20
-5
lines changed
3 files changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,13 @@ export interface UserConfig<ThemeConfig = any> {
64
64
* @experimental
65
65
*/
66
66
mpa ?: boolean
67
+
68
+ /**
69
+ * Don't fail builds due to dead links.
70
+ *
71
+ * @default false
72
+ */
73
+ ignoreDeadLinks ?: boolean
67
74
}
68
75
69
76
export type RawConfigExports < ThemeConfig = any > =
@@ -74,7 +81,13 @@ export type RawConfigExports<ThemeConfig = any> =
74
81
export interface SiteConfig < ThemeConfig = any >
75
82
extends Pick <
76
83
UserConfig ,
77
- 'markdown' | 'vue' | 'vite' | 'shouldPreload' | 'mpa' | 'lastUpdated'
84
+ | 'markdown'
85
+ | 'vue'
86
+ | 'vite'
87
+ | 'shouldPreload'
88
+ | 'mpa'
89
+ | 'lastUpdated'
90
+ | 'ignoreDeadLinks'
78
91
> {
79
92
root : string
80
93
srcDir : string
@@ -152,7 +165,8 @@ export async function resolveConfig(
152
165
vue : userConfig . vue ,
153
166
vite : userConfig . vite ,
154
167
shouldPreload : userConfig . shouldPreload ,
155
- mpa : ! ! userConfig . mpa
168
+ mpa : ! ! userConfig . mpa ,
169
+ ignoreDeadLinks : userConfig . ignoreDeadLinks
156
170
}
157
171
158
172
return config
Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ export const createMarkdownRenderer = async (
61
61
const md = MarkdownIt ( {
62
62
html : true ,
63
63
linkify : true ,
64
- highlight : await highlight ( options . theme ) ,
64
+ highlight : options . highlight || ( await highlight ( options . theme ) ) ,
65
65
...options
66
66
} ) as MarkdownRenderer
67
67
Original file line number Diff line number Diff line change @@ -44,7 +44,8 @@ export async function createVitePressPlugin(
44
44
site,
45
45
vue : userVuePluginOptions ,
46
46
vite : userViteConfig ,
47
- pages
47
+ pages,
48
+ ignoreDeadLinks
48
49
} = siteConfig
49
50
50
51
let markdownToVue : Awaited < ReturnType < typeof createMarkdownToVueRenderFn > >
@@ -153,7 +154,7 @@ export async function createVitePressPlugin(
153
154
} ,
154
155
155
156
renderStart ( ) {
156
- if ( hasDeadLinks ) {
157
+ if ( hasDeadLinks && ! ignoreDeadLinks ) {
157
158
throw new Error ( `One or more pages contain dead links.` )
158
159
}
159
160
} ,
You can’t perform that action at this time.
0 commit comments