diff --git a/lib/rules_block/state_block.js b/lib/rules_block/state_block.js index dedd7b2..39e8e4e 100644 --- a/lib/rules_block/state_block.js +++ b/lib/rules_block/state_block.js @@ -57,6 +57,7 @@ function StateBlock(src, parser, tokens, options, env) { } if (ch === 0x0A || pos === len - 1) { + if (ch !== 0x0A) { pos++; } this.bMarks.push(start); this.eMarks.push(pos); this.tShift.push(indent); diff --git a/test/misc.js b/test/misc.js new file mode 100644 index 0000000..46e9303 --- /dev/null +++ b/test/misc.js @@ -0,0 +1,17 @@ +/*global describe, it*/ +'use strict'; + + +var assert = require('assert'); +var Remarkable = require('../'); + + +describe('Misc', function () { + + it('Should correctly parse strings without tailing \\n', function () { + var md = new Remarkable(); + + assert.strictEqual(md.render('123'), '

123

\n'); + assert.strictEqual(md.render('123\n'), '

123

\n'); + }); +});