Skip to content

Commit

Permalink
fix: allow sublist to be single space in pedantic (#1924)
Browse files Browse the repository at this point in the history
  • Loading branch information
UziTech committed Feb 3, 2021
1 parent b97b802 commit 1e36afd
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Tokenizer.js
Expand Up @@ -241,8 +241,11 @@ module.exports = class Tokenizer {
// Backpedal if it does not belong in this list.
if (i !== l - 1) {
bnext = this.rules.block.listItemStart.exec(itemMatch[i + 1]);

if (bnext[1].length > bcurr[0].length || bnext[1].length > 3) {
if (
!this.options.pedantic
? bnext[1].length > bcurr[0].length || bnext[1].length > 3
: bnext[1].length > bcurr[1].length
) {
// nested list
itemMatch.splice(i, 2, itemMatch[i] + '\n' + itemMatch[i + 1]);
i--;
Expand Down
15 changes: 15 additions & 0 deletions test/specs/new/list_align_pedantic.html
@@ -0,0 +1,15 @@
<ul>
<li>one
<ul>
<li>two</li>
<li>three</li>
<li>four
<ul>
<li>five</li>
<li>six</li>
<li>seven</li>
</ul>
</li>
</ul>
</li>
</ul>
10 changes: 10 additions & 0 deletions test/specs/new/list_align_pedantic.md
@@ -0,0 +1,10 @@
---
pedantic: true
---
- one
- two
- three
- four
- five
- six
- seven

1 comment on commit 1e36afd

@vercel
Copy link

@vercel vercel bot commented on 1e36afd Feb 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.