fix: do not allow a blank line inside a link reference definition label (#4165)

Co-authored-by: aman <aman@pronnel.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aman Jha
2026-11-02 07:58:15 -07:00
committed by GitHub
co-authored by aman Claude Opus 5.5
parent 1d4d8fe6f5
commit f3d21af070
3 changed files with 24 additions and 1 deletions
+1 -1
View File
@@ -148,7 +148,7 @@ const lheadingGfm = edit(lheadingCore)
.getRegex();
const _paragraph = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/;
const blockText = /^[^\n]+/;
const _blockLabel = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/;
const _blockLabel = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\\n]|\n(?![ \t]*\n))+/;
const def = edit(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/)
.replace('label', _blockLabel)
// An escaped delimiter is part of the title, so a backslash must consume the
+10
View File
@@ -0,0 +1,10 @@
<p>[foo</p>
<p>bar]: /url</p>
<p>[foo</p>
<p>bar]</p>
<p><a href="/url">baz
qux</a></p>
+13
View File
@@ -0,0 +1,13 @@
[foo
bar]: /url
[foo
bar]
[baz
qux]: /url
[baz
qux]