Browse Source

Fix an issue with links skipping space after them

pull/14/head
Alex Kocharin 10 years ago
parent
commit
8470c1cae8
  1. 4
      lib/rules_inline/links.js
  2. 16
      test/fixtures/commonmark/bad.txt
  3. 11
      test/fixtures/commonmark/good.txt

4
lib/rules_inline/links.js

@ -114,8 +114,10 @@ module.exports = function links(state, silent) {
if (pos >= 0) { if (pos >= 0) {
label = state.src.slice(start, pos++); label = state.src.slice(start, pos++);
} else { } else {
pos = start - 1; pos = labelEnd + 1;
} }
} else {
pos = labelEnd + 1;
} }
// covers label === '' and label === undefined // covers label === '' and label === undefined

16
test/fixtures/commonmark/bad.txt

@ -58,19 +58,3 @@ error:
<p><a href="/uri">foo <em>bar [baz][ref]</em></a></p> <p><a href="/uri">foo <em>bar [baz][ref]</em></a></p>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src line: 5915
.
[foo] bar
[foo]: /url
.
<p><a href="/url">foo</a> bar</p>
.
error:
<p><a href="/url">foo</a>bar</p>

11
test/fixtures/commonmark/good.txt

@ -5204,6 +5204,17 @@ src line: 5905
<p><a href="/url" title="title">Foo</a></p> <p><a href="/url" title="title">Foo</a></p>
. .
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src line: 5915
.
[foo] bar
[foo]: /url
.
<p><a href="/url">foo</a> bar</p>
.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src line: 5926 src line: 5926

Loading…
Cancel
Save