fix(utils): Markdown linkification match local paths beginning with http (#6478)

This commit is contained in:
Joshua Chen 2022-01-27 09:26:31 +08:00 committed by GitHub
parent d6cff8c754
commit 02186a2b20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View file

@ -64,7 +64,8 @@ export function replaceMarkdownLinks<T extends ContentPaths>({
// Replace inline-style links or reference-style links e.g:
// This is [Document 1](doc1.md) -> we replace this doc1.md with correct link
// [doc1]: doc1.md -> we replace this doc1.md with correct link
const mdRegex = /(?:(?:\]\()|(?:\]:\s?))(?!https?)([^'")\]\s>]+\.mdx?)/g;
const mdRegex =
/(?:(?:\]\()|(?:\]:\s?))(?!https?:\/\/)([^'")\]\s>]+\.mdx?)/g;
let mdMatch = mdRegex.exec(modifiedLine);
while (mdMatch !== null) {
// Replace it to correct html link.