From c07caeb30da6b0477b0ea3dcc4912d24a648e706 Mon Sep 17 00:00:00 2001 From: eitsupi <50911393+eitsupi@users.noreply.github.com> Date: Mon, 22 Jan 2024 04:26:15 +0000 Subject: [PATCH] fix: allow spaces before `mdx-code-block` --- packages/docusaurus-utils/src/markdownUtils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/docusaurus-utils/src/markdownUtils.ts b/packages/docusaurus-utils/src/markdownUtils.ts index 87aac88f09b1..ce0766de6ce2 100644 --- a/packages/docusaurus-utils/src/markdownUtils.ts +++ b/packages/docusaurus-utils/src/markdownUtils.ts @@ -70,9 +70,9 @@ export function escapeMarkdownHeadingIds(content: string): string { export function unwrapMdxCodeBlocks(content: string): string { // We only support 3/4 backticks on purpose, should be good enough const regexp3 = - /(?^|\n)```mdx-code-block\n(?.*?)\n```(?\n|$)/gs; + /(?^|\n)```(?\x20*)mdx-code-block\n(?.*?)\n```(?\n|$)/gs; const regexp4 = - /(?^|\n)````mdx-code-block\n(?.*?)\n````(?\n|$)/gs; + /(?^|\n)````(?\x20*)mdx-code-block\n(?.*?)\n````(?\n|$)/gs; // eslint-disable-next-line @typescript-eslint/no-explicit-any const replacer = (substring: string, ...args: any[]) => {