2022-07-26 16:31:57 -05:00
|
|
|
import { renderMarkdown } from '../dist/index.js';
|
|
|
|
import { expect } from 'chai';
|
|
|
|
|
|
|
|
describe('entities', () => {
|
2022-08-05 09:23:16 -05:00
|
|
|
it('should not unescape entities in regular Markdown', async () => {
|
|
|
|
const { code } = await renderMarkdown(`<i>This should NOT be italic</i>`, {
|
|
|
|
isAstroFlavoredMd: false,
|
|
|
|
});
|
2022-07-26 16:31:57 -05:00
|
|
|
|
|
|
|
expect(code).to.equal(`<p><i>This should NOT be italic</i></p>`);
|
|
|
|
});
|
2022-08-05 09:23:16 -05:00
|
|
|
|
|
|
|
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,
|
|
|
|
});
|
2022-08-05 09:23:16 -05:00
|
|
|
|
|
|
|
expect(code).to.equal(
|
|
|
|
`<pre is:raw><code class="language-astro"><h1>{x && x.name || ''}!</h1>\n</code></pre>`
|
|
|
|
);
|
|
|
|
});
|
2022-07-26 16:31:57 -05:00
|
|
|
});
|