diff --git a/src/generators/server-side-rendering/visitors/Text.ts b/src/generators/server-side-rendering/visitors/Text.ts index b7aad398f2..493d32a936 100644 --- a/src/generators/server-side-rendering/visitors/Text.ts +++ b/src/generators/server-side-rendering/visitors/Text.ts @@ -7,5 +7,5 @@ export default function visitText( block: Block, node: Node ) { - generator.append(node.data.replace(/(\${|`|\\)/g, '\\$1').replace(/([^\\])?([@#])/g, '$1\\$2')); + generator.append(node.data.replace(/(\${|`|\\)/g, '\\$1').replace(/([^\\@#])?([@#])/g, '$1\\$2')); } diff --git a/src/utils/stringify.ts b/src/utils/stringify.ts index 7c63b45ce1..b4c65addfd 100644 --- a/src/utils/stringify.ts +++ b/src/utils/stringify.ts @@ -1,3 +1,3 @@ export default function stringify(data: string) { - return JSON.stringify(data.replace(/([^\\])?([@#])/g, '$1\\$2')); + return JSON.stringify(data.replace(/([^\\@#])?([@#])/g, '$1\\$2')); }