diff --git a/lib/rules_inline/links.js b/lib/rules_inline/links.js index 522138d..05b668d 100644 --- a/lib/rules_inline/links.js +++ b/lib/rules_inline/links.js @@ -18,6 +18,7 @@ module.exports = function links(state, silent) { ref, code, isImage = false, + oldPos = state.pos, max = state.posMax, start = state.pos, marker = state.src.charCodeAt(start); @@ -86,7 +87,7 @@ module.exports = function links(state, silent) { } if (pos >= max || state.src.charCodeAt(pos) !== 0x29/* ) */) { - state.pos = labelStart - 1; + state.pos = oldPos; return false; } pos++; @@ -121,7 +122,7 @@ module.exports = function links(state, silent) { ref = state.env.references[normalizeReference(label)]; if (!ref) { - state.pos = labelStart - 1; + state.pos = oldPos; return false; } href = ref.href; diff --git a/test/fixtures/remarkable/commonmark_extras.txt b/test/fixtures/remarkable/commonmark_extras.txt index bbd9a61..ade023b 100644 --- a/test/fixtures/remarkable/commonmark_extras.txt +++ b/test/fixtures/remarkable/commonmark_extras.txt @@ -77,3 +77,13 @@ Link label has priority over emphasis (not covered by stmd tests):

**link**

. +Issue #55: + +. +![test] + +![test](foo bar) +. +

![test]

+

![test](foo bar)

+.