Skip to content

Commit 4bd2528

Browse files
authored
fix: respect tab stops in list continuation indentation (#4119)
* fix: respect tab stops in list continuation indentation * test: move tab-stop regressions to spec fixtures
1 parent 9e64a6a commit 4bd2528

29 files changed

Lines changed: 167 additions & 1 deletion

‎src/Tokenizer.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ export class _Tokenizer<ParserOutput = string, RendererOutput = string> {
386386
nextLine = nextLine.replace(this.rules.other.listReplaceNesting, ' ');
387387
nextLineWithoutTabs = nextLine;
388388
} else {
389-
nextLineWithoutTabs = nextLine.replace(this.rules.other.leadingSpaceTab, whitespace => whitespace.replace(this.rules.other.tabCharGlobal, ' '));
389+
nextLineWithoutTabs = nextLine.replace(this.rules.other.leadingSpaceTab, whitespace => expandTabs(whitespace));
390390
}
391391

392392
// End list item if found code fences
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<ul>
2+
<li><p>foo</p>
3+
<p> bar</p>
4+
</li>
5+
</ul>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
gfm: false
3+
---
4+
- foo
5+
6+
bar
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<ul>
2+
<li><p>foo</p>
3+
<p> bar</p>
4+
</li>
5+
</ul>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
gfm: true
3+
---
4+
- foo
5+
6+
bar
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<ul>
2+
<li><p>foo</p>
3+
<pre><code> bar
4+
</code></pre>
5+
</li>
6+
</ul>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
gfm: false
3+
---
4+
- foo
5+
6+
bar
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<ul>
2+
<li><p>foo</p>
3+
<pre><code> bar
4+
</code></pre>
5+
</li>
6+
</ul>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
gfm: true
3+
---
4+
- foo
5+
6+
bar
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<ul>
2+
<li><p>foo</p>
3+
<p> bar baz</p>
4+
</li>
5+
</ul>

0 commit comments

Comments
 (0)