diff --git a/packages/astro/test/astro-markdown.test.js b/packages/astro/test/astro-markdown.test.js index 0afbfdf36..6ebdf3bfa 100644 --- a/packages/astro/test/astro-markdown.test.js +++ b/packages/astro/test/astro-markdown.test.js @@ -82,7 +82,7 @@ describe('Astro Markdown', () => { it.only('Can handle HTML comments in inline code', async () => { const html = await fixture.readFile('/comment-with-js/index.html'); const $ = cheerio.load(html); - + expect($('p code').text()).to.equal(''); }); @@ -90,7 +90,7 @@ describe('Astro Markdown', () => { const html = await fixture.readFile('/comment-with-js/index.html'); const $ = cheerio.load(html); - expect($('body > code').text()).to.equal('') + expect($('body > code').text()).to.equal(''); }); // https://github.com/withastro/astro/issues/3254 diff --git a/packages/markdown/remark/src/remark-escape.ts b/packages/markdown/remark/src/remark-escape.ts index 312bbe2cd..dd8a921ff 100644 --- a/packages/markdown/remark/src/remark-escape.ts +++ b/packages/markdown/remark/src/remark-escape.ts @@ -1,5 +1,5 @@ -import { visit } from 'unist-util-visit'; import type { Literal } from 'unist'; +import { visit } from 'unist-util-visit'; // In code blocks, this removes the JS comment wrapper added to // HTML comments by vite-plugin-markdown. @@ -10,8 +10,6 @@ export default function remarkEscape() { }; function removeCommentWrapper(node: Literal) { - node.value = node.value - .replace(/{\/\*\*\/}/gs, '-->'); + node.value = node.value.replace(/{\/\*\*\/}/gs, '-->'); } } diff --git a/packages/markdown/remark/test/expressions.test.js b/packages/markdown/remark/test/expressions.test.js index 12ddc1f48..fdf578923 100644 --- a/packages/markdown/remark/test/expressions.test.js +++ b/packages/markdown/remark/test/expressions.test.js @@ -81,9 +81,7 @@ describe('expressions', () => { }); it('should unwrap HTML comments in inline code blocks', async () => { - const { code } = await renderMarkdown( - `\`{/**/}\`` - ); + const { code } = await renderMarkdown(`\`{/**/}\``); chai.expect(code).to.equal('

<!-- HTML comment -->

'); }); @@ -97,6 +95,6 @@ describe('expressions', () => { ` ); - chai.expect(code).to.match(/(?