diff --git a/packages/highlight/src/__tests__/highlighter.test.ts b/packages/highlight/src/__tests__/highlighter.test.ts index 386b0c6364..c245d42da1 100644 --- a/packages/highlight/src/__tests__/highlighter.test.ts +++ b/packages/highlight/src/__tests__/highlighter.test.ts @@ -144,6 +144,19 @@ const title = "Hello"; ); }); + it("keeps an Astro expression open through nested template strings", () => { + const code = "

{`a ${`}`} b`}

"; + + const tokens = highlightCode(code, "Nested.astro").flat(); + + expect(tokens).toEqual( + expect.arrayContaining([ + { text: "`}`", style: "string" }, + { text: " b`", style: "string" }, + ]), + ); + }); + it("highlights Vue SFCs across script, template, and style", () => { const code = [ '