From ae029ae9e17fa6df1d2f89043f1891271e9c5b9b Mon Sep 17 00:00:00 2001 From: fuchunhui Date: Thu, 6 Jan 2022 11:05:32 +0800 Subject: [PATCH] fix: Chinese file link build failed (#425) fix #424 --- src/node/markdownToVue.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/node/markdownToVue.ts b/src/node/markdownToVue.ts index bc01c15dd19b..083f60dac8d6 100644 --- a/src/node/markdownToVue.ts +++ b/src/node/markdownToVue.ts @@ -89,10 +89,12 @@ export function createMarkdownToVueRenderFn( for (let url of data.links) { url = url.replace(/[?#].*$/, '').replace(/\.(html|md)$/, '') if (url.endsWith('/')) url += `index` - const resolved = slash( - url.startsWith('/') - ? url.slice(1) - : path.relative(srcDir, path.resolve(dir, url)) + const resolved = decodeURIComponent( + slash( + url.startsWith('/') + ? url.slice(1) + : path.relative(srcDir, path.resolve(dir, url)) + ) ) if ( !pages.includes(resolved) &&