Skip to content

Commit

Permalink
fix(utils): Markdown link replacement with <> but no spaces (#9617)
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-Cena committed Dec 7, 2023
1 parent 8dd1e13 commit c8c93a3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
Expand Up @@ -176,6 +176,7 @@ exports[`replaceMarkdownLinks replaces links with same title as URL 1`] = `
"brokenMarkdownLinks": [],
"newContent": "
[foo.md](/docs/foo)
[./foo.md](</docs/foo>)
[./foo.md](/docs/foo)
[foo.md](/docs/foo)
[./foo.md](/docs/foo)
Expand Down
Expand Up @@ -231,6 +231,7 @@ The following operations are defined for [URI]s:
},
fileString: `
[foo.md](foo.md)
[./foo.md](<./foo.md>)
[./foo.md](./foo.md)
[foo.md](./foo.md)
[./foo.md](foo.md)
Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus-utils/src/markdownLinks.ts
Expand Up @@ -128,7 +128,7 @@ export function replaceMarkdownLinks<T extends ContentPaths>({
const linkSuffixPattern = '(?:\\?[^#>\\s]+)?(?:#[^>\\s]+)?';
const linkCapture = (forbidden: string) =>
`((?!https?://|@site/)[^${forbidden}#?]+)`;
const linkURLPattern = `(?:${linkCapture(
const linkURLPattern = `(?:(?!<)${linkCapture(
'()\\s',
)}${linkSuffixPattern}|<${linkCapture('>')}${linkSuffixPattern}>)`;
const linkPattern = new RegExp(
Expand Down

0 comments on commit c8c93a3

Please sign in to comment.