Browse Source

Remove tabs at the beginning of the line in paragraphs

pull/343/head
Alex Kocharin 7 years ago
parent
commit
dc1c392a4d
  1. 5
      lib/rules_inline/newline.js
  2. 22
      test/fixtures/markdown-it/commonmark_extras.txt

5
lib/rules_inline/newline.js

@ -2,6 +2,9 @@
'use strict';
var isSpace = require('../common/utils').isSpace;
module.exports = function newline(state, silent) {
var pmax, max, pos = state.pos;
@ -32,7 +35,7 @@ module.exports = function newline(state, silent) {
pos++;
// skip heading spaces for next line
while (pos < max && state.src.charCodeAt(pos) === 0x20) { pos++; }
while (pos < max && isSpace(state.src.charCodeAt(pos))) { pos++; }
state.pos = pos;
return true;

22
test/fixtures/markdown-it/commonmark_extras.txt

@ -159,6 +159,28 @@ Info string in fenced code block can't contain marker used for the fence
<pre><code class="test`"></code></pre>
.
Tabs should be stripped from the beginning of the line
.
foo
bar
baz
.
<p>foo
bar
baz</p>
.
Tabs should not cause hardbreak, EOL tabs aren't stripped in commonmark 0.27
.
foo1
foo2
bar
.
<p>foo1
foo2<br>
bar</p>
.
Coverage. Directive can terminate paragraph.
.
a

Loading…
Cancel
Save