Skip to content

Commit 73c969c

Browse files
authored
fix: incorrect code snippet syntax (#2189)
1 parent 30963d6 commit 73c969c

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

packages/slidev/node/syntax/transform/snippet.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export function transformSnippet({ s, slide, options }: MarkdownTransformContext
8787

8888
s.replace(
8989
// eslint-disable-next-line regexp/no-super-linear-backtracking
90-
/^<<<\s*(\S.*?)(#[\w-]+)?\s*(?:\s(\S+?))?\s*(\{.*)?$/gm,
90+
/^<<<[ \t]*(\S.*?)(#[\w-]+)?[ \t]*(?:[ \t](\S+?))?[ \t]*(\{.*)?$/gm,
9191
(full, filepath = '', regionName = '', lang = '', meta = '') => {
9292
const src = slash(
9393
/^@\//.test(filepath)

test/__snapshots__/transform-all.test.ts.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,6 @@ function _foo() {
9696
9797
</CodeBlockWrapper>
9898
99+
99100
</template>"
100101
`;

0 commit comments

Comments
 (0)