Skip to content

Commit 6a03bbe

Browse files
committed
fix: only detect link_modifier around an attached_modifier
nvim-neorg/neorg#292 (comment)
1 parent 9e11856 commit 6a03bbe

File tree

5 files changed

+228538
-221108
lines changed

5 files changed

+228538
-221108
lines changed

grammar.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,13 @@ module.exports = grammar({
206206
alias($.capitalized_word, "_uppercase"),
207207
),
208208

209+
_linked_attached_modifier: $ =>
210+
prec.right(2, seq(
211+
$.link_modifier,
212+
$.attached_modifier,
213+
$.link_modifier,
214+
)),
215+
209216
// Any regular text
210217
_paragraph: $ =>
211218
prec.right(0,
@@ -227,8 +234,9 @@ module.exports = grammar({
227234
$.anchor_declaration,
228235
$.anchor_definition,
229236
$.escape_sequence,
230-
$.link_modifier,
231237
$.attached_modifier,
238+
$._linked_attached_modifier,
239+
alias($.link_modifier, "_lowercase"),
232240
alias($.bold_close, "_lowercase"),
233241
alias($.italic_close, "_lowercase"),
234242
alias($.strikethrough_close, "_lowercase"),

src/grammar.json

+32-2
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,27 @@
8181
}
8282
]
8383
},
84+
"_linked_attached_modifier": {
85+
"type": "PREC_RIGHT",
86+
"value": 2,
87+
"content": {
88+
"type": "SEQ",
89+
"members": [
90+
{
91+
"type": "SYMBOL",
92+
"name": "link_modifier"
93+
},
94+
{
95+
"type": "SYMBOL",
96+
"name": "attached_modifier"
97+
},
98+
{
99+
"type": "SYMBOL",
100+
"name": "link_modifier"
101+
}
102+
]
103+
}
104+
},
84105
"_paragraph": {
85106
"type": "PREC_RIGHT",
86107
"value": 0,
@@ -154,11 +175,20 @@
154175
},
155176
{
156177
"type": "SYMBOL",
157-
"name": "link_modifier"
178+
"name": "attached_modifier"
158179
},
159180
{
160181
"type": "SYMBOL",
161-
"name": "attached_modifier"
182+
"name": "_linked_attached_modifier"
183+
},
184+
{
185+
"type": "ALIAS",
186+
"content": {
187+
"type": "SYMBOL",
188+
"name": "link_modifier"
189+
},
190+
"named": false,
191+
"value": "_lowercase"
162192
},
163193
{
164194
"type": "ALIAS",

0 commit comments

Comments
 (0)