diff --git a/packages/slidev/node/syntax/transform/code-wrapper.ts b/packages/slidev/node/syntax/transform/code-wrapper.ts
index 4915df3852..8795408cb2 100644
--- a/packages/slidev/node/syntax/transform/code-wrapper.ts
+++ b/packages/slidev/node/syntax/transform/code-wrapper.ts
@@ -2,7 +2,7 @@ import type { MarkdownTransformContext } from '@slidev/types'
import { normalizeRangeStr } from './utils'
// eslint-disable-next-line regexp/no-super-linear-backtracking
-export const reCodeBlock = /^```([\w'-]+)(?:\s*\{([\w*,|-]+)\}\s*?(\{[^}]*\})?([^\r\n]*))?\r?\n(\S[\s\S]*?)^```$/gm
+export const reCodeBlock = /^```([\w'-]+)?\s*(?:\{([\w*,|-]+)\}\s*?(\{[^}]*\})?([^\r\n]*))?\r?\n(\S[\s\S]*?)^```$/gm
/**
* Transform code block with wrapper
diff --git a/test/__snapshots__/transform-all.test.ts.snap b/test/__snapshots__/transform-all.test.ts.snap
index 4fe6d16a9d..273d077d05 100644
--- a/test/__snapshots__/transform-all.test.ts.snap
+++ b/test/__snapshots__/transform-all.test.ts.snap
@@ -47,5 +47,15 @@ Foo \`{{ code }}\`
+
+
+\`\`\`ts
+function _foo() {
+ // ...
+}
+\`\`\`
+
+
+
"
`;
diff --git a/test/transform-all.test.ts b/test/transform-all.test.ts
index e90339b5fd..61406a1034 100644
--- a/test/transform-all.test.ts
+++ b/test/transform-all.test.ts
@@ -26,6 +26,8 @@ Foo \`{{ code }}\`
+
+<<< ./fixtures/snippets/snippet.ts#snippet
`)
applyMarkdownTransform(ctx)