@@ -109,6 +109,11 @@ module.exports = grammar(add_inline_rules({
109109 [ $ . shortcut_link , $ . _link_text ] ,
110110 [ $ . link_destination , $ . link_title ] ,
111111 [ $ . _link_destination_parenthesis , $ . link_title ] ,
112+
113+ [ $ . wiki_link , $ . _inline_element ] ,
114+ [ $ . wiki_link , $ . _inline_element_no_star ] ,
115+ [ $ . wiki_link , $ . _inline_element_no_underscore ] ,
116+ [ $ . wiki_link , $ . _inline_element_no_tilde ] ,
112117 ] ,
113118 extras : $ => [ ] ,
114119
@@ -184,6 +189,29 @@ module.exports = grammar(add_inline_rules({
184189 ')'
185190 ) ) ,
186191
192+ wiki_link : $ => prec . dynamic ( 2 * PRECEDENCE_LEVEL_LINK , seq (
193+ '[' , '[' ,
194+ alias ( $ . _wiki_link_destination , $ . link_destination ) ,
195+ optional ( seq (
196+ '|' ,
197+ alias ( $ . _wiki_link_text , $ . link_text )
198+ ) ) ,
199+ ']' , ']'
200+ )
201+ ) ,
202+
203+ _wiki_link_destination : $ => repeat1 ( choice (
204+ $ . _word ,
205+ common . punctuation_without ( $ , [ '[' , ']' , '|' ] ) ,
206+ $ . _whitespace ,
207+ ) ) ,
208+
209+ _wiki_link_text : $ => repeat1 ( choice (
210+ $ . _word ,
211+ common . punctuation_without ( $ , [ '[' , ']' ] ) ,
212+ $ . _whitespace ,
213+ ) ) ,
214+
187215 // Images work exactly like links with a '!' added in front.
188216 //
189217 // https://github.github.com/gfm/#images
@@ -407,8 +435,12 @@ function add_inline_rules(grammar) {
407435 $ . full_reference_link ,
408436 $ . collapsed_reference_link ,
409437 $ . inline_link ,
438+ // (common.EXTENSION_WIKI_LINK && $.wiki_link),
410439 seq ( choice ( '[' , ']' ) , optional ( $ . _last_token_punctuation ) ) ,
411440 ] ) ;
441+ if ( common . EXTENSION_WIKI_LINK ) {
442+ elements . push ( $ . wiki_link ) ;
443+ }
412444 }
413445 return choice ( ...elements ) ;
414446 } ;
0 commit comments