diff --git a/lib/rules_block/reference.js b/lib/rules_block/reference.js index 77a30f1..ab742cc 100644 --- a/lib/rules_block/reference.js +++ b/lib/rules_block/reference.js @@ -27,14 +27,13 @@ module.exports = function reference(state, startLine, _endLine, silent) { max = state.eMarks[startLine], nextLine = startLine + 1; - if (pos >= max) { return false; } if (state.src.charCodeAt(pos) !== 0x5B/* [ */) { return false; } endLine = state.lineMax; // jump line-by-line until empty one or EOF if (nextLine < endLine && !state.isEmpty(nextLine)) { - terminatorRules = state.md.block.ruler.getRules('references'); + terminatorRules = state.md.block.ruler.getRules('reference'); for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) { // this would be a code block normally, but after paragraph diff --git a/test/fixtures/markdown-it/commonmark_extras.txt b/test/fixtures/markdown-it/commonmark_extras.txt index 493bfb1..192b6a3 100644 --- a/test/fixtures/markdown-it/commonmark_extras.txt +++ b/test/fixtures/markdown-it/commonmark_extras.txt @@ -231,3 +231,15 @@ Coverage. Link .
[test](
. + +Coverage. Reference +. +[ +test\ +]: 123 +foo +bar +. +foo +bar
+. diff --git a/test/fixtures/markdown-it/xss.txt b/test/fixtures/markdown-it/xss.txt index 2223d10..677f28f 100644 --- a/test/fixtures/markdown-it/xss.txt +++ b/test/fixtures/markdown-it/xss.txt @@ -77,3 +77,11 @@ javascript:alert(1)javascript:alert(1)
javascript:alert(1)
. + +References + +. +[test]: javascript:alert(1) +. +[test]: javascript:alert(1)
+.