fix: fix tabs at beginning of list items (#2679)
* fix: fix tabs at beginning of list items * test: add test for ordered list
This commit is contained in:
parent
1bbda688f5
commit
e692634f70
@ -203,7 +203,7 @@ export class Tokenizer {
|
|||||||
raw = cap[0];
|
raw = cap[0];
|
||||||
src = src.substring(raw.length);
|
src = src.substring(raw.length);
|
||||||
|
|
||||||
line = cap[2].split('\n', 1)[0];
|
line = cap[2].split('\n', 1)[0].replace(/^\t+/, (t) => ' '.repeat(3 * t.length));
|
||||||
nextLine = src.split('\n', 1)[0];
|
nextLine = src.split('\n', 1)[0];
|
||||||
|
|
||||||
if (this.options.pedantic) {
|
if (this.options.pedantic) {
|
||||||
@ -225,7 +225,7 @@ export class Tokenizer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!endEarly) {
|
if (!endEarly) {
|
||||||
const nextBulletRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:[*+-]|\\d{1,9}[.)])((?: [^\\n]*)?(?:\\n|$))`);
|
const nextBulletRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`);
|
||||||
const hrRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`);
|
const hrRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`);
|
||||||
const fencesBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:\`\`\`|~~~)`);
|
const fencesBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:\`\`\`|~~~)`);
|
||||||
const headingBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}#`);
|
const headingBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}#`);
|
||||||
|
17
test/specs/new/list_item_tabs.html
Normal file
17
test/specs/new/list_item_tabs.html
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<ul>
|
||||||
|
<li>A</li>
|
||||||
|
<li>B</li>
|
||||||
|
<li>C</li>
|
||||||
|
<li>D</li>
|
||||||
|
<li>E</li>
|
||||||
|
<li>F</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<ol>
|
||||||
|
<li>A</li>
|
||||||
|
<li>B</li>
|
||||||
|
<li>C</li>
|
||||||
|
<li>D</li>
|
||||||
|
<li>E</li>
|
||||||
|
<li>F</li>
|
||||||
|
</ol>
|
13
test/specs/new/list_item_tabs.md
Normal file
13
test/specs/new/list_item_tabs.md
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
- A
|
||||||
|
- B
|
||||||
|
- C
|
||||||
|
- D
|
||||||
|
- E
|
||||||
|
- F
|
||||||
|
|
||||||
|
1. A
|
||||||
|
2. B
|
||||||
|
3. C
|
||||||
|
4. D
|
||||||
|
5. E
|
||||||
|
6. F
|
Loading…
x
Reference in New Issue
Block a user