Skip to content

Commit f0791db

Browse files
committed
fix(preprocess-markdown): negate {@...} pattern via rehype plugin
1 parent c963667 commit f0791db

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

.changeset/selfish-singers-act.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@svelte-put/preprocess-markdown': patch
3+
---
4+
5+
rehype negate `{@...}` pattern

packages/preprocess-markdown/src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ function rehypeNegateSvelteLogicBlock() {
9696
if (!parent || !index) return;
9797
const firstChild = node.children.at(0);
9898
if (!firstChild) return;
99-
if (firstChild.type === 'text' && firstChild.value.startsWith('{#')) {
99+
if (firstChild.type === 'text' && ['{#', '{@'].some(t => firstChild.value.startsWith(t))) {
100100
parent.children.splice(index, 1, ...node.children);
101101
}
102102
})

0 commit comments

Comments
 (0)