Skip to content

Commit

Permalink
fix code after list
Browse files Browse the repository at this point in the history
  • Loading branch information
UziTech committed Feb 10, 2021
1 parent 2e9376d commit e3f53bd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/Tokenizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ module.exports = class Tokenizer {

if (!this.options.pedantic) {
// Determine if current item contains the end of the list
endMatch = item.match(new RegExp(`\\n *\\n {0,${bcurr[0].length - 1}}\\S`));
endMatch = item.match(new RegExp('\\n *\\n {0,' + (bcurr[0].length - 1) + '}\\S'));
if (endMatch) {
// console.log(item, endMatch);
let num = item.length - endMatch.index;
Expand All @@ -256,8 +256,8 @@ module.exports = class Tokenizer {
? 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]);
// nested list or continuation
itemMatch.splice(i, 2, itemMatch[i] + (!itemMatch[i].match(/\n$/) && !this.options.pedantic && bnext[1].length < bcurr[0].length ? '' : '\n') + itemMatch[i + 1]);
i--;
l--;
continue;
Expand Down
3 changes: 1 addition & 2 deletions test/specs/commonmark/commonmark.0.29.json
Original file line number Diff line number Diff line change
Expand Up @@ -2270,8 +2270,7 @@
"example": 282,
"start_line": 5177,
"end_line": 5191,
"section": "Lists",
"shouldFail": true
"section": "Lists"
},
{
"markdown": "1. a\n\n 2. b\n\n 3. c\n",
Expand Down
3 changes: 1 addition & 2 deletions test/specs/gfm/commonmark.0.29.json
Original file line number Diff line number Diff line change
Expand Up @@ -2270,8 +2270,7 @@
"example": 282,
"start_line": 5177,
"end_line": 5191,
"section": "Lists",
"shouldFail": true
"section": "Lists"
},
{
"markdown": "1. a\n\n 2. b\n\n 3. c\n",
Expand Down

0 comments on commit e3f53bd

Please sign in to comment.