Skip to content

Commit

Permalink
do not match for short curlies when repeating: {1}{2}
Browse files Browse the repository at this point in the history
fixes issue #58
  • Loading branch information
arve0 committed May 6, 2018
1 parent eef1b2e commit 229293f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,5 +267,11 @@ describe('markdown-it-attrs', () => {
expected = '<p>bla <code class="c">click()</code> blah <code class="cpp">release()</code></p>\n';
assert.equal(md.render(src), expected);
});

it('should not remove {} curlies with length < 4', () => {
src = 'do not remove the curlies {1}{2}';
expected = '<p>do not remove the curlies {1}{2}</p>\n';
assert.equal(md.render(src), expected);
});
});

2 changes: 1 addition & 1 deletion utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ exports.hasCurly = function (where) {
case 'end':
// last char should be }
end = str.charAt(str.length - 1) === '}';
start = end && str.indexOf('{');
start = end && str.lastIndexOf('{');
return end && (start + 3) < str.length;

case 'only':
Expand Down

0 comments on commit 229293f

Please sign in to comment.