Browse Source

Fixed termination rules check when rules disabled, closes #13

pull/14/head
Vitaly Puzrin 10 years ago
parent
commit
8b3f29df82
  1. 3
      lib/ruler.js
  2. 8
      test/misc.js

3
lib/ruler.js

@ -208,7 +208,8 @@ Ruler.prototype.getRules = function (chainName) {
this.__compile__();
}
return this.__cache__[chainName];
// Chain can be empty, if rules disabled. But we still have to return Array.
return this.__cache__[chainName] || [];
};
module.exports = Ruler;

8
test/misc.js

@ -200,7 +200,7 @@ describe('Misc', function () {
assert.strictEqual(md.render('*b*'), '<par><it>b</it></par>');
});
it('zero preset should disable everything', function () {
it('Zero preset should disable everything', function () {
var md = markdownit('zero');
assert.strictEqual(md.render('___foo___'), '<p>___foo___</p>\n');
@ -212,6 +212,12 @@ describe('Misc', function () {
assert.strictEqual(md.renderInline('___foo___'), '<strong><em>foo</em></strong>');
});
it('Should correctly check block termination rules ahen those are disabled (#13)', function () {
var md = markdownit('zero');
assert.strictEqual(md.render('foo\nbar'), '<p>foo\nbar</p>\n');
});
});

Loading…
Cancel
Save