From a9895f72d06e2b4ad58f2917559ce45445c47877 Mon Sep 17 00:00:00 2001 From: Vitaly Puzrin Date: Wed, 29 Oct 2014 10:55:35 +0300 Subject: [PATCH] Fixed regression in 1.2.1 release, closes #88 --- lib/rules_block/state_block.js | 1 + test/misc.js | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 test/misc.js 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'); + }); +});