diff --git a/lib/rules_inline/links.js b/lib/rules_inline/links.js index 8823139..004fcad 100644 --- a/lib/rules_inline/links.js +++ b/lib/rules_inline/links.js @@ -114,8 +114,10 @@ module.exports = function links(state, silent) { if (pos >= 0) { label = state.src.slice(start, pos++); } else { - pos = start - 1; + pos = labelEnd + 1; } + } else { + pos = labelEnd + 1; } // covers label === '' and label === undefined diff --git a/test/fixtures/commonmark/bad.txt b/test/fixtures/commonmark/bad.txt index 99fae07..82fcb0a 100644 --- a/test/fixtures/commonmark/bad.txt +++ b/test/fixtures/commonmark/bad.txt @@ -58,19 +58,3 @@ error:
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -src line: 5915 - -. -[foo] bar - -[foo]: /url -. -foo bar
-. - -error: - -foobar
- - diff --git a/test/fixtures/commonmark/good.txt b/test/fixtures/commonmark/good.txt index cff2f5c..4a0e233 100644 --- a/test/fixtures/commonmark/good.txt +++ b/test/fixtures/commonmark/good.txt @@ -5204,6 +5204,17 @@ src line: 5905 . +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +src line: 5915 + +. +[foo] bar + +[foo]: /url +. +foo bar
+. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src line: 5926