[ci] format

This commit is contained in:
hippotastic 2022-08-05 14:24:50 +00:00 committed by fredkbot
parent 16034f0dd5
commit e7bee22d18
2 changed files with 5 additions and 8 deletions

View file

@ -1,4 +1,4 @@
import { visit, SKIP } from 'unist-util-visit'; import { SKIP, visit } from 'unist-util-visit';
export function escapeEntities(value: string): string { export function escapeEntities(value: string): string {
return value.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;'); return value.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');

View file

@ -11,13 +11,10 @@ describe('entities', () => {
}); });
it('should not escape entities in code blocks twice in Astro-flavored markdown', async () => { it('should not escape entities in code blocks twice in Astro-flavored markdown', async () => {
const { code } = await renderMarkdown( const { code } = await renderMarkdown(`\`\`\`astro\n<h1>{x && x.name || ''}!</h1>\n\`\`\``, {
`\`\`\`astro\n<h1>{x && x.name || ''}!</h1>\n\`\`\``, isAstroFlavoredMd: true,
{ syntaxHighlight: false,
isAstroFlavoredMd: true, });
syntaxHighlight: false,
}
);
expect(code).to.equal( 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>` `<pre is:raw><code class="language-astro">&lt;h1&gt;{x &amp;&amp; x.name || ''}!&lt;/h1&gt;\n</code></pre>`