Skip to content

Commit

Permalink
fix: fix heading in code in list item
Browse files Browse the repository at this point in the history
  • Loading branch information
UziTech committed Jul 4, 2022
1 parent 0273ab8 commit 766442f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Tokenizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ export class Tokenizer {
if (!endEarly) {
const nextBulletRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:[*+-]|\\d{1,9}[.)])((?: [^\\n]*)?(?:\\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)}})#`);

// Check if following lines should be included in List Item
while (src) {
Expand All @@ -244,7 +245,7 @@ export class Tokenizer {
}

// End list item if found start of new heading
if (this.rules.block.heading.test(line)) {
if (headingBeginRegex.test(line)) {
break;
}

Expand Down
7 changes: 7 additions & 0 deletions test/specs/new/list_code_header.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<ul>
<li>
<p>list</p>
<pre><code># header
</code></pre>
</li>
</ul>
5 changes: 5 additions & 0 deletions test/specs/new/list_code_header.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- list

```
# header
```

0 comments on commit 766442f

Please sign in to comment.