diff options
Diffstat (limited to 'packages/markdown/remark/test/entities.test.js')
-rw-r--r-- | packages/markdown/remark/test/entities.test.js | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/packages/markdown/remark/test/entities.test.js b/packages/markdown/remark/test/entities.test.js index a6b5918a5..dff844329 100644 --- a/packages/markdown/remark/test/entities.test.js +++ b/packages/markdown/remark/test/entities.test.js @@ -2,11 +2,25 @@ import { renderMarkdown } from '../dist/index.js'; import { expect } from 'chai'; describe('entities', () => { - const renderAstroMd = (text) => renderMarkdown(text, { isAstroFlavoredMd: false }); - - it('should not unescape entities', async () => { - const { code } = await renderAstroMd(`<i>This should NOT be italic</i>`); + it('should not unescape entities in regular Markdown', async () => { + const { code } = await renderMarkdown(`<i>This should NOT be italic</i>`, { + isAstroFlavoredMd: false, + }); expect(code).to.equal(`<p><i>This should NOT be italic</i></p>`); }); + + it('should not escape entities in code blocks twice in Astro-flavored markdown', async () => { + const { code } = await renderMarkdown( + `\`\`\`astro\n<h1>{x && x.name || ''}!</h1>\n\`\`\``, + { + isAstroFlavoredMd: true, + syntaxHighlight: false, + } + ); + + expect(code).to.equal( + `<pre is:raw><code class="language-astro"><h1>{x && x.name || ''}!</h1>\n</code></pre>` + ); + }); }); |