doc: link error, close #5652

pull/5653/head
tangjinzhou 2022-05-28 14:21:03 +08:00
parent 9b0fb707e2
commit d5bb271dd8
1 changed files with 4 additions and 4 deletions

View File

@ -45,10 +45,10 @@ export const linkPlugin = (md: MarkdownIt, externalAttrs: Record<string, string>
if (cleanUrl.endsWith('.md')) {
cleanUrl = cleanUrl.replace(/\.md$/, '.html');
}
// ./foo -> ./foo.html
if (!cleanUrl.endsWith('.html') && !cleanUrl.endsWith('/')) {
cleanUrl += '.html';
}
// // ./foo -> ./foo.html
// if (!cleanUrl.endsWith('.html') && !cleanUrl.endsWith('/')) {
// cleanUrl += '.html';
// }
const parsed = new URL(url, 'http://a.com');
url = cleanUrl + parsed.search + parsed.hash;
}