mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-07 05:12:31 +02:00
fix(mdx-loader): mdx-code-block should support CRLF (#9897)
This commit is contained in:
parent
0589b1475d
commit
2152572a3b
2 changed files with 33 additions and 2 deletions
|
@ -1166,6 +1166,37 @@ describe('unwrapMdxCodeBlocks', () => {
|
|||
`);
|
||||
});
|
||||
|
||||
it('can unwrap a simple mdx code block with CRLF', () => {
|
||||
// Note: looks like string dedent mess up with \r
|
||||
expect(
|
||||
unwrapMdxCodeBlocks(`
|
||||
# Title\r
|
||||
\`\`\`mdx-code-block\r
|
||||
import Comp, {User} from "@site/components/comp"\r
|
||||
\r
|
||||
<Comp prop="test">\r
|
||||
<User user={{firstName: "Sébastien"}} />\r
|
||||
</Comp>\r
|
||||
\r
|
||||
export const age = 36\r
|
||||
\`\`\`\r
|
||||
\r
|
||||
text\r
|
||||
`),
|
||||
).toBe(`
|
||||
# Title\r
|
||||
import Comp, {User} from "@site/components/comp"\r
|
||||
\r
|
||||
<Comp prop="test">\r
|
||||
<User user={{firstName: "Sébastien"}} />\r
|
||||
</Comp>\r
|
||||
\r
|
||||
export const age = 36\r
|
||||
\r
|
||||
text\r
|
||||
`);
|
||||
});
|
||||
|
||||
it('can unwrap a nested mdx code block', () => {
|
||||
expect(
|
||||
unwrapMdxCodeBlocks(dedent`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue