fix(markdown): mdx-code-block should support intentation (#10240)

This commit is contained in:
Sébastien Lorber 2024-06-20 19:43:32 +02:00 committed by GitHub
parent 97630b438e
commit 3a0a2a74b8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 32 additions and 2 deletions

View file

@ -1229,6 +1229,36 @@ text\r
`);
});
it('can unwrap indented mdx code block', () => {
expect(
unwrapMdxCodeBlocks(dedent`
# Title
<div>
\`\`\`mdx-code-block
content
\`\`\`
</div>
\`\`\`\`mdx-code-block
content2
\`\`\`\`
text
`),
).toEqual(dedent`
# Title
<div>
content
</div>
content2
text
`);
});
it('works for realistic example', () => {
expect(
unwrapMdxCodeBlocks(dedent`