mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-03 20:27:20 +02:00
fix(utils): Markdown link replacement with <> but no spaces (#9617)
This commit is contained in:
parent
8dd1e13f2a
commit
c8c93a3854
3 changed files with 3 additions and 1 deletions
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Add table
Reference in a new issue