fix(utils): convert Markdown links in reference-style links (#6617)

This commit is contained in:
Joshua Chen 2022-02-05 19:37:20 +08:00 committed by GitHub
parent d2574b287f
commit 74a645e612
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 44 additions and 1 deletions

View file

@ -67,7 +67,7 @@ export function replaceMarkdownLinks<T extends ContentPaths>({
// ink
// [doc1]: doc1.md -> we replace this doc1.md with correct link
const mdRegex =
/(?:(?:\]\()|(?:\]:\s?))(?!https?:\/\/|@site\/)(?<filename>[^'")\]\s>]+\.mdx?)/g;
/(?:(?:\]\()|(?:\]:\s*))(?!https?:\/\/|@site\/)(?<filename>[^'")\]\s>]+\.mdx?)/g;
let mdMatch = mdRegex.exec(modifiedLine);
while (mdMatch !== null) {
// Replace it to correct html link.