Skip to content

Commit

Permalink
Fix support for definitions in list and blockquote
Browse files Browse the repository at this point in the history
Closes GH-401.
Closes GH-418.

Reviewed-by: Christian Murphy <[email protected]>
  • Loading branch information
wooorm authored Jul 11, 2019
1 parent 2f0edce commit e2ea7e8
Show file tree
Hide file tree
Showing 13 changed files with 427 additions and 2,704 deletions.
2 changes: 0 additions & 2 deletions packages/remark-parse/lib/tokenize/definition.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ var whitespace = require('is-whitespace-character')
var normalize = require('../util/normalize')

module.exports = definition
definition.notInList = true
definition.notInBlock = true

var quotationMark = '"'
var apostrophe = "'"
Expand Down
9 changes: 9 additions & 0 deletions test/fixtures/input/definition-in-list-and-blockquote.text
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[alpha][1], [bravo][2].

* Definition in list:

[1]: alpha

> Definition in blockquote:
>
> [2]: bravo
63 changes: 5 additions & 58 deletions test/fixtures/tree/def-blocks.commonmark.json
Original file line number Diff line number Diff line change
Expand Up @@ -312,64 +312,11 @@
"checked": null,
"children": [
{
"type": "paragraph",
"children": [
{
"type": "linkReference",
"identifier": "3",
"label": "3",
"referenceType": "shortcut",
"children": [
{
"type": "text",
"value": "3",
"position": {
"start": {
"line": 11,
"column": 4,
"offset": 61
},
"end": {
"line": 11,
"column": 5,
"offset": 62
},
"indent": []
}
}
],
"position": {
"start": {
"line": 11,
"column": 3,
"offset": 60
},
"end": {
"line": 11,
"column": 6,
"offset": 63
},
"indent": []
}
},
{
"type": "text",
"value": ": hello",
"position": {
"start": {
"line": 11,
"column": 6,
"offset": 63
},
"end": {
"line": 11,
"column": 13,
"offset": 70
},
"indent": []
}
}
],
"type": "definition",
"identifier": "3",
"label": "3",
"title": null,
"url": "hello",
"position": {
"start": {
"line": 11,
Expand Down
126 changes: 10 additions & 116 deletions test/fixtures/tree/def-blocks.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,64 +40,11 @@
}
},
{
"type": "paragraph",
"children": [
{
"type": "linkReference",
"identifier": "1",
"label": "1",
"referenceType": "shortcut",
"children": [
{
"type": "text",
"value": "1",
"position": {
"start": {
"line": 2,
"column": 4,
"offset": 11
},
"end": {
"line": 2,
"column": 5,
"offset": 12
},
"indent": []
}
}
],
"position": {
"start": {
"line": 2,
"column": 3,
"offset": 10
},
"end": {
"line": 2,
"column": 6,
"offset": 13
},
"indent": []
}
},
{
"type": "text",
"value": ": hello",
"position": {
"start": {
"line": 2,
"column": 6,
"offset": 13
},
"end": {
"line": 2,
"column": 13,
"offset": 20
},
"indent": []
}
}
],
"type": "definition",
"identifier": "1",
"label": "1",
"title": null,
"url": "hello",
"position": {
"start": {
"line": 2,
Expand Down Expand Up @@ -285,64 +232,11 @@
"checked": null,
"children": [
{
"type": "paragraph",
"children": [
{
"type": "linkReference",
"identifier": "3",
"label": "3",
"referenceType": "shortcut",
"children": [
{
"type": "text",
"value": "3",
"position": {
"start": {
"line": 11,
"column": 4,
"offset": 61
},
"end": {
"line": 11,
"column": 5,
"offset": 62
},
"indent": []
}
}
],
"position": {
"start": {
"line": 11,
"column": 3,
"offset": 60
},
"end": {
"line": 11,
"column": 6,
"offset": 63
},
"indent": []
}
},
{
"type": "text",
"value": ": hello",
"position": {
"start": {
"line": 11,
"column": 6,
"offset": 63
},
"end": {
"line": 11,
"column": 13,
"offset": 70
},
"indent": []
}
}
],
"type": "definition",
"identifier": "3",
"label": "3",
"title": null,
"url": "hello",
"position": {
"start": {
"line": 11,
Expand Down
Loading

0 comments on commit e2ea7e8

Please sign in to comment.