Skip to content

Commit

Permalink
feat: add detached modifier fallbacks to non-headings
Browse files Browse the repository at this point in the history
Detached heading modifiers greater than level 6 fall back to that level.
The same is now done by quotes, lists and link lists.
  • Loading branch information
mrossinek committed Jan 20, 2022
1 parent fff5fc2 commit e3d4779
Show file tree
Hide file tree
Showing 6 changed files with 144,553 additions and 143,586 deletions.
37 changes: 25 additions & 12 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,19 @@ module.exports = grammar({
[$.inline_comment, $._paragraph_element],
[$.inline_math, $._paragraph_element],
[$.variable, $._paragraph_element],

[$.unordered_link1, $.paragraph],
[$.unordered_link2, $.paragraph],
[$.unordered_link3, $.paragraph],
[$.unordered_link4, $.paragraph],
[$.unordered_link5, $.paragraph],
[$.unordered_link6, $.paragraph],
[$.ordered_link1, $.paragraph],
[$.ordered_link2, $.paragraph],
[$.ordered_link3, $.paragraph],
[$.ordered_link4, $.paragraph],
[$.ordered_link5, $.paragraph],
[$.ordered_link6, $.paragraph],
],

externals: $ => [
Expand Down Expand Up @@ -529,7 +542,7 @@ module.exports = grammar({
)),

unordered_link1: $ =>
prec.right(1,
prec.right(0,
seq(
$.unordered_link1_prefix,

Expand All @@ -555,7 +568,7 @@ module.exports = grammar({
),

unordered_link2: $ =>
prec.right(1,
prec.right(0,
seq(
$.unordered_link2_prefix,

Expand All @@ -581,7 +594,7 @@ module.exports = grammar({
),

unordered_link3: $ =>
prec.right(1,
prec.right(0,
seq(
$.unordered_link3_prefix,

Expand All @@ -607,7 +620,7 @@ module.exports = grammar({
),

unordered_link4: $ =>
prec.right(1,
prec.right(0,
seq(
$.unordered_link4_prefix,

Expand All @@ -633,7 +646,7 @@ module.exports = grammar({
),

unordered_link5: $ =>
prec.right(1,
prec.right(0,
seq(
$.unordered_link5_prefix,

Expand All @@ -659,7 +672,7 @@ module.exports = grammar({
),

unordered_link6: $ =>
prec.right(1,
prec.right(0,
seq(
$.unordered_link6_prefix,

Expand All @@ -681,7 +694,7 @@ module.exports = grammar({
),

ordered_link1: $ =>
prec.right(1,
prec.right(0,
seq(
$.ordered_link1_prefix,

Expand All @@ -707,7 +720,7 @@ module.exports = grammar({
),

ordered_link2: $ =>
prec.right(1,
prec.right(0,
seq(
$.ordered_link2_prefix,

Expand All @@ -733,7 +746,7 @@ module.exports = grammar({
),

ordered_link3: $ =>
prec.right(1,
prec.right(0,
seq(
$.ordered_link3_prefix,

Expand All @@ -759,7 +772,7 @@ module.exports = grammar({
),

ordered_link4: $ =>
prec.right(1,
prec.right(0,
seq(
$.ordered_link4_prefix,

Expand All @@ -785,7 +798,7 @@ module.exports = grammar({
),

ordered_link5: $ =>
prec.right(1,
prec.right(0,
seq(
$.ordered_link5_prefix,

Expand All @@ -811,7 +824,7 @@ module.exports = grammar({
),

ordered_link6: $ =>
prec.right(1,
prec.right(0,
seq(
$.ordered_link6_prefix,

Expand Down
72 changes: 60 additions & 12 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -1518,7 +1518,7 @@
},
"unordered_link1": {
"type": "PREC_RIGHT",
"value": 1,
"value": 0,
"content": {
"type": "SEQ",
"members": [
Expand Down Expand Up @@ -1580,7 +1580,7 @@
},
"unordered_link2": {
"type": "PREC_RIGHT",
"value": 1,
"value": 0,
"content": {
"type": "SEQ",
"members": [
Expand Down Expand Up @@ -1642,7 +1642,7 @@
},
"unordered_link3": {
"type": "PREC_RIGHT",
"value": 1,
"value": 0,
"content": {
"type": "SEQ",
"members": [
Expand Down Expand Up @@ -1704,7 +1704,7 @@
},
"unordered_link4": {
"type": "PREC_RIGHT",
"value": 1,
"value": 0,
"content": {
"type": "SEQ",
"members": [
Expand Down Expand Up @@ -1766,7 +1766,7 @@
},
"unordered_link5": {
"type": "PREC_RIGHT",
"value": 1,
"value": 0,
"content": {
"type": "SEQ",
"members": [
Expand Down Expand Up @@ -1828,7 +1828,7 @@
},
"unordered_link6": {
"type": "PREC_RIGHT",
"value": 1,
"value": 0,
"content": {
"type": "SEQ",
"members": [
Expand Down Expand Up @@ -1883,7 +1883,7 @@
},
"ordered_link1": {
"type": "PREC_RIGHT",
"value": 1,
"value": 0,
"content": {
"type": "SEQ",
"members": [
Expand Down Expand Up @@ -1945,7 +1945,7 @@
},
"ordered_link2": {
"type": "PREC_RIGHT",
"value": 1,
"value": 0,
"content": {
"type": "SEQ",
"members": [
Expand Down Expand Up @@ -2007,7 +2007,7 @@
},
"ordered_link3": {
"type": "PREC_RIGHT",
"value": 1,
"value": 0,
"content": {
"type": "SEQ",
"members": [
Expand Down Expand Up @@ -2069,7 +2069,7 @@
},
"ordered_link4": {
"type": "PREC_RIGHT",
"value": 1,
"value": 0,
"content": {
"type": "SEQ",
"members": [
Expand Down Expand Up @@ -2131,7 +2131,7 @@
},
"ordered_link5": {
"type": "PREC_RIGHT",
"value": 1,
"value": 0,
"content": {
"type": "SEQ",
"members": [
Expand Down Expand Up @@ -2193,7 +2193,7 @@
},
"ordered_link6": {
"type": "PREC_RIGHT",
"value": 1,
"value": 0,
"content": {
"type": "SEQ",
"members": [
Expand Down Expand Up @@ -4929,6 +4929,54 @@
[
"variable",
"_paragraph_element"
],
[
"unordered_link1",
"paragraph"
],
[
"unordered_link2",
"paragraph"
],
[
"unordered_link3",
"paragraph"
],
[
"unordered_link4",
"paragraph"
],
[
"unordered_link5",
"paragraph"
],
[
"unordered_link6",
"paragraph"
],
[
"ordered_link1",
"paragraph"
],
[
"ordered_link2",
"paragraph"
],
[
"ordered_link3",
"paragraph"
],
[
"ordered_link4",
"paragraph"
],
[
"ordered_link5",
"paragraph"
],
[
"ordered_link6",
"paragraph"
]
],
"precedences": [],
Expand Down
Loading

0 comments on commit e3d4779

Please sign in to comment.