Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ const def = edit(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +
.replace('title', /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/)
.getRegex();

const list = edit(/^(bull)([ \t][^\n]+?)?(?:\n|$)/)
const list = edit(/^(bull)([ \t][^\n]*?)?(?:\n|$)/)
.replace(/bull/g, bullet)
.getRegex();

Expand Down Expand Up @@ -170,7 +170,7 @@ const paragraph = edit(_paragraph)
.replace('|table', '')
.replace('blockquote', ' {0,3}>')
.replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n')
.replace('list', ' {0,3}(?:[*+-]|1[.)])[ \\t]') // only lists starting from 1 can interrupt
.replace('list', ' {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]') // only non-empty lists starting from 1 can interrupt
.replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)')
.replace('tag', _tag) // pars can be interrupted by type (6) html blocks
.getRegex();
Expand Down Expand Up @@ -214,7 +214,7 @@ const gfmTable = edit(
.replace('blockquote', ' {0,3}>')
.replace('code', '(?: {4}| {0,3}\t)[^\\n]')
.replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n')
.replace('list', ' {0,3}(?:[*+-]|1[.)])[ \\t]') // only lists starting from 1 can interrupt
.replace('list', ' {0,3}(?:[*+-]|1[.)])[ \\t]') // any bullet ends the table rows
.replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)')
.replace('tag', _tag) // tables can be interrupted by type (6) html blocks
.getRegex();
Expand All @@ -230,7 +230,7 @@ const blockGfm: Record<BlockKeys, RegExp> = {
.replace('table', gfmTable) // interrupt paragraphs with table
.replace('blockquote', ' {0,3}>')
.replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n')
.replace('list', ' {0,3}(?:[*+-]|1[.)])[ \\t]') // only lists starting from 1 can interrupt
.replace('list', ' {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]') // only non-empty lists starting from 1 can interrupt
.replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)')
.replace('tag', _tag) // pars can be interrupted by type (6) html blocks
.getRegex(),
Expand Down
16 changes: 16 additions & 0 deletions test/specs/new/list_item_empty_trailing_space.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<ul>
<li></li>
</ul>
<ul>
<li></li>
</ul>
<ol>
<li></li>
</ol>
<ol>
<li></li>
</ol>
<p>foo
+</p>
<p>bar
1.</p>
13 changes: 13 additions & 0 deletions test/specs/new/list_item_empty_trailing_space.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
-

*

1.

1)

foo
+

bar
1.