diff options
author | 2025-01-09 22:57:02 +0800 | |
---|---|---|
committer | 2025-01-09 22:57:02 +0800 | |
commit | a20a4d7b8ffe3ae941b5c510b319ac6f9783aabe (patch) | |
tree | 2692fd883e94c4e1dea15c09f28da0432680ca78 /packages/integrations/markdoc/test/syntax-highlighting.test.js | |
parent | ce842c9b7e27b8ab1c5d43bafd1a64a7bfa29194 (diff) | |
download | astro-a20a4d7b8ffe3ae941b5c510b319ac6f9783aabe.tar.gz astro-a20a4d7b8ffe3ae941b5c510b319ac6f9783aabe.tar.zst astro-a20a4d7b8ffe3ae941b5c510b319ac6f9783aabe.zip |
Fix markdoc render code block in if tag (#12930)
Diffstat (limited to 'packages/integrations/markdoc/test/syntax-highlighting.test.js')
-rw-r--r-- | packages/integrations/markdoc/test/syntax-highlighting.test.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/packages/integrations/markdoc/test/syntax-highlighting.test.js b/packages/integrations/markdoc/test/syntax-highlighting.test.js index f47b891f4..6ea841ae1 100644 --- a/packages/integrations/markdoc/test/syntax-highlighting.test.js +++ b/packages/integrations/markdoc/test/syntax-highlighting.test.js @@ -68,6 +68,27 @@ describe('Markdoc - syntax highlighting', () => { assert.equal(pre.getAttribute('style').includes('word-wrap: break-word'), true); } }); + it('transform within if tags', async () => { + const ast = Markdoc.parse(` +{% if equals("true", "true") %} +Inside truthy + +\`\`\`js +const hello = "yes"; +\`\`\` + +{% /if %}`); + const content = await Markdoc.transform(ast, await getConfigExtendingShiki()); + assert.equal(content.children.length, 1); + assert.equal(content.children[0].length, 2); + const pTag = content.children[0][0]; + assert.equal(pTag.name, 'p'); + const codeBlock = content.children[0][1]; + assert.equal(isHTMLString(codeBlock), true); + const pre = parsePreTag(codeBlock); + assert.equal(pre.classList.contains('astro-code'), true); + assert.equal(pre.classList.contains('github-dark'), true); + }); }); describe('prism', () => { |