mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-06 10:20:09 +02:00
fix(utils): handle Markdown links with spaces to route correctly (#8874)
This commit is contained in:
parent
3d31c55fe7
commit
2b994262b0
3 changed files with 40 additions and 1 deletions
|
@ -256,6 +256,31 @@ The following operations are defined for [URI]s:
|
|||
},
|
||||
fileString: `
|
||||
[a](a.md), [a](a.md), [b](b.md), [c](c.md)
|
||||
`,
|
||||
}),
|
||||
).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('replaces Markdown links with spaces', () => {
|
||||
expect(
|
||||
replaceMarkdownLinks({
|
||||
siteDir: '.',
|
||||
filePath: 'docs/intro.md',
|
||||
contentPaths: {
|
||||
contentPath: 'docs',
|
||||
contentPathLocalized: 'i18n/docs-localized',
|
||||
},
|
||||
sourceToPermalink: {
|
||||
'@site/docs/doc a.md': '/docs/doc%20a',
|
||||
'@site/docs/my docs/doc b.md': '/docs/my%20docs/doc%20b',
|
||||
},
|
||||
fileString: `
|
||||
[doc a](./doc%20a.md)
|
||||
[doc a](<./doc a.md>)
|
||||
[doc a](./doc a.md)
|
||||
[doc b](./my%20docs/doc%20b.md)
|
||||
[doc b](<./my docs/doc b.md>)
|
||||
[doc b](./my docs/doc b.md)
|
||||
`,
|
||||
}),
|
||||
).toMatchSnapshot();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue