diff --git a/src/rules.ts b/src/rules.ts index aeb880c597..568fca4e52 100644 --- a/src/rules.ts +++ b/src/rules.ts @@ -282,7 +282,7 @@ const blockPedantic: Record = { const escape = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/; const inlineCode = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/; -const br = /^( {2,}|\\)\n(?!\s*$)/; +const br = /^( {2,}|\\)\n(?!\s*$)[ \t]*/; const inlineText = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\foo
bar

+

foo
bar

+

foo
bar

+

foo
bar

+

foo + bar

+

foo +bar

diff --git a/test/specs/new/hardbreak_leading_whitespace.md b/test/specs/new/hardbreak_leading_whitespace.md new file mode 100644 index 0000000000..14ec0ca7a6 --- /dev/null +++ b/test/specs/new/hardbreak_leading_whitespace.md @@ -0,0 +1,20 @@ +--- +renderExact: true +--- +foo + bar + +foo\ + bar + +foo + bar + +foo + bar + +foo + bar + +foo +bar