Skip to content

Commit

Permalink
[ci] format
Browse files Browse the repository at this point in the history
  • Loading branch information
tony-sull authored and github-actions[bot] committed Jun 20, 2022
1 parent 80c71c7 commit 9502fbf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
4 changes: 2 additions & 2 deletions packages/astro/test/astro-markdown.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ 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('<!-- HTML comments in code -->');
});

it('Can handle HTML comments in code fences', async () => {
const html = await fixture.readFile('/comment-with-js/index.html');
const $ = cheerio.load(html);

expect($('body > code').text()).to.equal('<!-- HTML comments in code fence -->')
expect($('body > code').text()).to.equal('<!-- HTML comments in code fence -->');
});

// https://github.com/withastro/astro/issues/3254
Expand Down
6 changes: 2 additions & 4 deletions packages/markdown/remark/src/remark-escape.ts
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -10,8 +10,6 @@ export default function remarkEscape() {
};

function removeCommentWrapper(node: Literal<string>) {
node.value = node.value
.replace(/{\/\*<!--/gs, '<!--')
.replace(/-->\*\/}/gs, '-->');
node.value = node.value.replace(/{\/\*<!--/gs, '<!--').replace(/-->\*\/}/gs, '-->');
}
}
6 changes: 2 additions & 4 deletions packages/markdown/remark/test/expressions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@ describe('expressions', () => {
});

it('should unwrap HTML comments in inline code blocks', async () => {
const { code } = await renderMarkdown(
`\`{/*<!-- HTML comment -->*/}\``
);
const { code } = await renderMarkdown(`\`{/*<!-- HTML comment -->*/}\``);

chai.expect(code).to.equal('<p><code is:raw>&lt;!-- HTML comment --&gt;</code></p>');
});
Expand All @@ -97,6 +95,6 @@ describe('expressions', () => {
`
);

chai.expect(code).to.match(/(?<!{\/\*)&lt;!-- HTML comment --&gt;(?!\*\/})/);
chai.expect(code).to.match(/(?<!{\/\*)&lt;!-- HTML comment --&gt;(?!\*\/})/);
});
});

0 comments on commit 9502fbf

Please sign in to comment.