Skip to content

Commit

Permalink
Fix handling of list-item bullets in gfm-mode
Browse files Browse the repository at this point in the history
Closes GH-110.
  • Loading branch information
wooorm committed Dec 22, 2015
1 parent 25a26f2 commit 6e74759
Show file tree
Hide file tree
Showing 12 changed files with 1,725 additions and 1,406 deletions.
9 changes: 1 addition & 8 deletions lib/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -1796,14 +1796,7 @@ function tokenizeList(eat, value, silent) {
}

if (currentMarker) {
// TODO: should be commonmark only.
// gfm sees the following as one list too:
//
// * one
// + two
// 1. three
//
if (!pedantic && marker !== currentMarker) {
if (commonmark && marker !== currentMarker) {
break;
}

Expand Down
351 changes: 351 additions & 0 deletions test/tree/mixed-indentation.commonmark.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,351 @@
{
"type": "root",
"children": [
{
"type": "heading",
"depth": 1,
"children": [
{
"type": "text",
"value": "Mixed spaces and tabs",
"position": {
"start": {
"line": 1,
"column": 3
},
"end": {
"line": 1,
"column": 24
},
"indent": []
}
}
],
"position": {
"start": {
"line": 1,
"column": 1
},
"end": {
"line": 1,
"column": 24
},
"indent": []
}
},
{
"type": "list",
"ordered": false,
"start": null,
"loose": false,
"children": [
{
"type": "listItem",
"loose": false,
"checked": null,
"children": [
{
"type": "paragraph",
"children": [
{
"type": "text",
"value": "Very long\n\t\t\tparagraph",
"position": {
"start": {
"line": 3,
"column": 3
},
"end": {
"line": 4,
"column": 12
},
"indent": [
0
]
}
}
],
"position": {
"start": {
"line": 3,
"column": 3
},
"end": {
"line": 4,
"column": 12
},
"indent": [
0
]
}
}
],
"position": {
"start": {
"line": 3,
"column": 1
},
"end": {
"line": 4,
"column": 12
},
"indent": [
1
]
}
}
],
"position": {
"start": {
"line": 3,
"column": 1
},
"end": {
"line": 4,
"column": 12
},
"indent": [
1
]
}
},
{
"type": "list",
"ordered": true,
"start": 1,
"loose": false,
"children": [
{
"type": "listItem",
"loose": false,
"checked": null,
"children": [
{
"type": "paragraph",
"children": [
{
"type": "text",
"value": "Very long\n\tparagraph",
"position": {
"start": {
"line": 6,
"column": 4
},
"end": {
"line": 7,
"column": 12
},
"indent": [
2
]
}
}
],
"position": {
"start": {
"line": 6,
"column": 4
},
"end": {
"line": 7,
"column": 12
},
"indent": [
2
]
}
}
],
"position": {
"start": {
"line": 6,
"column": 1
},
"end": {
"line": 7,
"column": 12
},
"indent": [
1
]
}
}
],
"position": {
"start": {
"line": 6,
"column": 1
},
"end": {
"line": 7,
"column": 12
},
"indent": [
1
]
}
},
{
"type": "list",
"ordered": false,
"start": null,
"loose": false,
"children": [
{
"type": "listItem",
"loose": false,
"checked": null,
"children": [
{
"type": "paragraph",
"children": [
{
"type": "text",
"value": "Very long\n\tparagraph",
"position": {
"start": {
"line": 9,
"column": 3
},
"end": {
"line": 10,
"column": 12
},
"indent": [
2
]
}
}
],
"position": {
"start": {
"line": 9,
"column": 3
},
"end": {
"line": 10,
"column": 12
},
"indent": [
2
]
}
}
],
"position": {
"start": {
"line": 9,
"column": 1
},
"end": {
"line": 10,
"column": 12
},
"indent": [
1
]
}
}
],
"position": {
"start": {
"line": 9,
"column": 1
},
"end": {
"line": 10,
"column": 12
},
"indent": [
1
]
}
},
{
"type": "list",
"ordered": true,
"start": 1,
"loose": false,
"children": [
{
"type": "listItem",
"loose": false,
"checked": null,
"children": [
{
"type": "paragraph",
"children": [
{
"type": "text",
"value": "Very long\n\tparagraph",
"position": {
"start": {
"line": 12,
"column": 4
},
"end": {
"line": 13,
"column": 12
},
"indent": [
2
]
}
}
],
"position": {
"start": {
"line": 12,
"column": 4
},
"end": {
"line": 13,
"column": 12
},
"indent": [
2
]
}
}
],
"position": {
"start": {
"line": 12,
"column": 1
},
"end": {
"line": 13,
"column": 12
},
"indent": [
1
]
}
}
],
"position": {
"start": {
"line": 12,
"column": 1
},
"end": {
"line": 13,
"column": 12
},
"indent": [
1
]
}
}
],
"position": {
"start": {
"line": 1,
"column": 1
},
"end": {
"line": 14,
"column": 1
}
}
}
Loading

0 comments on commit 6e74759

Please sign in to comment.