0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-23 21:53:55 -05:00
astro/packages/markdown/remark/test/entities.test.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
796 B
JavaScript
Raw Normal View History

import { renderMarkdown } from '../dist/index.js';
import { expect } from 'chai';
describe('entities', () => {
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>&#x3C;i>This should NOT be italic&#x3C;/i></p>`);
});
it('should not escape entities in code blocks twice in Astro-flavored markdown', async () => {
2022-08-05 09:24:50 -05:00
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">&lt;h1&gt;{x &amp;&amp; x.name || ''}!&lt;/h1&gt;\n</code></pre>`
);
});
});