diff --git a/packages/docusaurus-utils/src/__tests__/markdownUtils.test.ts b/packages/docusaurus-utils/src/__tests__/markdownUtils.test.ts index 0e04dbf5c280..734baea200bd 100644 --- a/packages/docusaurus-utils/src/__tests__/markdownUtils.test.ts +++ b/packages/docusaurus-utils/src/__tests__/markdownUtils.test.ts @@ -1251,6 +1251,38 @@ describe('unwrapMdxCodeBlocks', () => { `); }); + + it('allow spaces before mdx-code-block info string', () => { + expect( + unwrapMdxCodeBlocks(dedent` + # Title + + \`\`\` mdx-code-block + import Comp, {User} from "@site/components/comp" + + + + + + export const age = 36 + \`\`\` + + text + `), + ).toEqual(dedent` + # Title + + import Comp, {User} from "@site/components/comp" + + + + + + export const age = 36 + + text + `); + }); }); describe('admonitionTitleToDirectiveLabel', () => {