Browse Source

Always suffix indented code block with a newline

pull/797/head
Taneli Hukkinen 3 years ago
committed by Alex Kocharin
parent
commit
e5986bb7cc
  1. 2
      lib/rules_block/code.js
  2. 3
      test/misc.js

2
lib/rules_block/code.js

@ -27,7 +27,7 @@ module.exports = function code(state, startLine, endLine/*, silent*/) {
state.line = last;
token = state.push('code_block', 'code', 0);
token.content = state.getLines(startLine, last, 4 + state.blkIndent, true);
token.content = state.getLines(startLine, last, 4 + state.blkIndent, false) + '\n';
token.map = [ startLine, state.line ];
return true;

3
test/misc.js

@ -182,6 +182,9 @@ describe('Misc', function () {
assert.strictEqual(md.render('123'), '<p>123</p>\n');
assert.strictEqual(md.render('123\n'), '<p>123</p>\n');
assert.strictEqual(md.render(' codeblock'), '<pre><code>codeblock\n</code></pre>\n');
assert.strictEqual(md.render(' codeblock\n'), '<pre><code>codeblock\n</code></pre>\n');
});
it('Should quickly exit on empty string', function () {

Loading…
Cancel
Save