@@ -172,6 +172,9 @@ variables:
172
172
)
173
173
fenced_code_block_escape : ^{{fenced_code_block_end}}
174
174
175
+ # https://pandoc.org/MANUAL.html#divs-and-spans
176
+ fenced_div_block : :{3,}
177
+
175
178
# https://spec.commonmark.org/0.30/#email-autolink
176
179
email_domain_commonmark : ' [a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?'
177
180
email_user_commonmark : ' [a-zA-Z0-9.!#$%&'' *+/=?^_`{|}~-]+'
@@ -262,6 +265,7 @@ variables:
262
265
| {{block_quote}} # a blockquote begins the line
263
266
| {{atx_heading}} # an ATX heading begins the line
264
267
| {{fenced_code_block_start}} # a fenced codeblock begins the line
268
+ | {{fenced_div_block}} # a fenced div block begins the line
265
269
| {{thematic_break}} # line is a thematic beak
266
270
| {{first_list_item}} # a list item begins the line
267
271
| {{html_block}} # a html block begins the line
@@ -275,6 +279,7 @@ variables:
275
279
| {{block_quote}} # a blockquote begins the line
276
280
| {{atx_heading}} # an ATX heading begins the line
277
281
| {{fenced_code_block_start}} # a fenced codeblock begins the line
282
+ | {{fenced_div_block}} # a fenced div block begins the line
278
283
| {{thematic_break}} # line is a thematic beak
279
284
| {{list_item}} # a list item begins the line
280
285
| {{html_block}} # a html block begins the line
@@ -347,6 +352,7 @@ contexts:
347
352
- include : list-blocks
348
353
- include : tables
349
354
- include : fenced-code-blocks
355
+ - include : fenced-div-blocks
350
356
- include : html-blocks
351
357
- include : reference-definitions
352
358
- include : atx-headings
@@ -579,6 +585,7 @@ contexts:
579
585
| {{reference_definition}} # a reference definition begins the line
580
586
| {{atx_heading}} # an ATX heading begins the line
581
587
| {{fenced_code_block_start}} # a fenced codeblock begins the line
588
+ | {{fenced_div_block}} # a fenced div block begins the line
582
589
| {{thematic_break}} # line is a thematic beak
583
590
| {{list_item}} # a list item begins the line
584
591
| {{html_block}} # a html block begins the line
@@ -690,6 +697,7 @@ contexts:
690
697
(?: $ # the line is blank (or only contains whitespace)
691
698
| {{atx_heading}} # an ATX heading begins the line
692
699
| {{fenced_code_block_start}} # a fenced codeblock begins the line
700
+ | {{fenced_div_block}} # a fenced div block begins the line
693
701
| {{thematic_break}} # line is a thematic beak
694
702
| {{list_item}} # a list item begins the line
695
703
| {{html_block}} # a html block begins the line
@@ -717,6 +725,7 @@ contexts:
717
725
(?: \s* $ # the line is blank (or only contains whitespace)
718
726
| {{atx_heading}} # an ATX heading begins the line
719
727
| {{fenced_code_block_start}} # a fenced codeblock begins the line
728
+ | {{fenced_div_block}} # a fenced div block begins the line
720
729
| {{thematic_break}} # line is a thematic beak
721
730
| {{list_item}} # a list item begins the line
722
731
| {{html_block}} # a html block begins the line
@@ -2249,6 +2258,7 @@ contexts:
2249
2258
| {{reference_definition}} # a reference definition begins the line
2250
2259
| {{atx_heading}} # an ATX heading begins the line
2251
2260
| {{fenced_code_block_start}} # a fenced codeblock begins the line
2261
+ | {{fenced_div_block}} # a fenced div block begins the line
2252
2262
| {{thematic_break}} # line is a thematic beak
2253
2263
| {{list_item}} # a list item begins the line
2254
2264
| {{html_block}} # a html block begins the line
@@ -2364,6 +2374,7 @@ contexts:
2364
2374
| {{atx_heading}}
2365
2375
| {{block_quote}}
2366
2376
| {{fenced_code_block_start}}
2377
+ | {{fenced_div_block}}
2367
2378
| {{indented_code_block}}
2368
2379
| {{thematic_break}}
2369
2380
)
@@ -3505,6 +3516,46 @@ contexts:
3505
3516
- include : scope:text.tex.latex#macros
3506
3517
- include : scope:text.tex.latex#math-content
3507
3518
3519
+ # ##[ EXTENSIONS: PANDOC FENCED DIVS ]##########################################
3520
+
3521
+ fenced-div-blocks :
3522
+ # https://pandoc.org/MANUAL.html#divs-and-spans
3523
+ - match : ^[ \t]*({{fenced_div_block}})[ \t]*(?=\S)
3524
+ captures :
3525
+ 1 : punctuation.section.block.begin.markdown
3526
+ push :
3527
+ - fenced-div-body
3528
+ - fenced-div-puncuation
3529
+ - fenced-div-attr
3530
+
3531
+ fenced-div-attr :
3532
+ - meta_include_prototype : false
3533
+ - match : \{
3534
+ scope : punctuation.definition.attributes.begin.markdown
3535
+ set : link-def-attr-body
3536
+ - match : ' {{tag_attribute_name_start}}'
3537
+ set :
3538
+ - tag-attr-meta
3539
+ - tag-attr-equals
3540
+ - tag-attr-name
3541
+ - match : else-pop
3542
+
3543
+ fenced-div-puncuation :
3544
+ - meta_include_prototype : false
3545
+ - match : ' :+'
3546
+ scope : punctuation.section.block.markdown
3547
+ pop : 1
3548
+ - include : else-pop
3549
+
3550
+ fenced-div-body :
3551
+ - meta_include_prototype : false
3552
+ - meta_scope : meta.block.div.markdown
3553
+ - match : ^[ \t]*(\1)(\s*\n)
3554
+ captures :
3555
+ 1 : punctuation.section.block.end.markdown
3556
+ pop : 1
3557
+ - include : markdown
3558
+
3508
3559
# ##[ PROTOTYPES ]#############################################################
3509
3560
3510
3561
else-pop :
@@ -3523,4 +3574,3 @@ contexts:
3523
3574
immediately-pop :
3524
3575
- match : ' '
3525
3576
pop : 1
3526
-
0 commit comments