Skip to content

Commit

Permalink
Fixes bug in the comment plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
rpaul-stripe committed Sep 19, 2022
1 parent d3fad67 commit 5577396
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/tokenizer/plugins/comments.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ describe('MarkdownIt Comments plugin', function () {
{ type: 'inline' },
{ type: 'paragraph_close' },
{ type: 'comment', content: 'example comment' },
{ type: 'paragraph_open' },
{ type: 'inline', content: 'foo' },
{ type: 'paragraph_close' },
];

it('simple block comment after a paragraph', function () {
Expand All @@ -56,6 +59,8 @@ describe('MarkdownIt Comments plugin', function () {
<!--
example comment
-->
foo
`);

expect(example).toDeepEqualSubset(output);
Expand All @@ -67,6 +72,8 @@ describe('MarkdownIt Comments plugin', function () {
<!--
example comment -->
foo
`);

expect(example).toDeepEqualSubset(output);
Expand All @@ -77,6 +84,8 @@ describe('MarkdownIt Comments plugin', function () {
this is a test
<!-- example comment -->
foo
`);

expect(example).toDeepEqualSubset(output);
Expand Down
2 changes: 1 addition & 1 deletion src/tokenizer/plugins/comments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function block(
const token = state.push('comment', '', 0);
token.content = content.trim();
token.map = [startLine, startLine + lines];
state.line = close;
state.line += lines;

return true;
}
Expand Down

0 comments on commit 5577396

Please sign in to comment.