|
@ -204,6 +204,15 @@ describe('Misc', function () { |
|
|
assert.strictEqual(md.render('foo\nbar'), '<p>foo\nbar</p>\n'); |
|
|
assert.strictEqual(md.render('foo\nbar'), '<p>foo\nbar</p>\n'); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it('Should render link target attr', function () { |
|
|
|
|
|
var md = markdownit() |
|
|
|
|
|
.use(require('markdown-it-for-inline'), 'target', 'link_open', function (tokens, idx) { |
|
|
|
|
|
tokens[idx].target = '_blank'; |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
assert.strictEqual(md.render('[foo](bar)'), '<p><a href="bar" target="_blank">foo</a></p>\n'); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -226,9 +235,17 @@ describe('Links validation', function () { |
|
|
|
|
|
|
|
|
describe('maxNesting', function () { |
|
|
describe('maxNesting', function () { |
|
|
|
|
|
|
|
|
it('Inline parser', function () { |
|
|
it('Inline parser should not nest above limit', function () { |
|
|
var md = markdownit({ maxNesting: 2 }); |
|
|
var md = markdownit({ maxNesting: 2 }); |
|
|
assert.strictEqual(md.render('*foo *bar *baz* bar* foo*'), '<p><em>foo <em>bar *baz* bar</em> foo</em></p>\n'); |
|
|
assert.strictEqual(md.render('*foo *bar *baz* bar* foo*'), '<p><em>foo <em>bar *baz* bar</em> foo</em></p>\n'); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it('Block parser should not nest above limit', function () { |
|
|
|
|
|
var md = markdownit({ maxNesting: 2 }); |
|
|
|
|
|
assert.strictEqual( |
|
|
|
|
|
md.render('>foo\n>>bar\n>>>baz'), |
|
|
|
|
|
'<blockquote>\n<p>foo</p>\n<blockquote>\n</blockquote>\n</blockquote>\n' |
|
|
|
|
|
); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
}); |
|
|
}); |
|
|