├── LICENSE ├── Quarto.sublime-settings ├── Quarto.sublime-syntax └── README.md /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2022 Rstudio, PBC 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Quarto.sublime-settings: -------------------------------------------------------------------------------- 1 | // These settings override both User and Default settings for the ql syntax 2 | { 3 | // yaml often uses 2, many markdown constructs require 4 4 | "tab_size": 2, 5 | 6 | // Set to true to insert spaces when tab is pressed 7 | "translate_tabs_to_spaces": true, 8 | } 9 | -------------------------------------------------------------------------------- /Quarto.sublime-syntax: -------------------------------------------------------------------------------- 1 | %YAML 1.2 2 | --- 3 | # http://www.sublimetext.com/docs/3/syntax.html 4 | # forked from: https://github.com/REditorSupport/sublime-ide-r/blob/master/R%20Markdown.sublime-syntax 5 | name: Quarto 6 | file_extensions: 7 | - qmd 8 | scope: text.html.markdown.quarto 9 | comment: |- 10 | this definition aims to meet CommonMark specifications http://spec.commonmark.org/ 11 | with GitHub Formatted Markdown extensions https://github.github.com/gfm/ 12 | and has a few extras like Markdown Extra's footnotes https://michelf.ca/projects/php-markdown/extra/#footnotes 13 | the scope suffix should indicate which flavor of Markdown the feature came from, to help make this syntax definition easier to maintain 14 | variables: 15 | thematic_break: |- 16 | (?x: 17 | [ ]{,3} # between 0 to 3 spaces 18 | (?: # followed by one of the following: 19 | [-](?:[ ]{,2}[-]){2,} # - a dash, followed by the following at least twice: between 0 to 2 spaces followed by a dash 20 | | [*](?:[ ]{,2}[*]){2,} # - a star, followed by the following at least twice: between 0 to 2 spaces followed by a star 21 | | [_](?:[ ]{,2}[_]){2,} # - an underscore, followed by the following at least twice: between 0 to 2 spaces followed by an underscore 22 | ) 23 | [ \t]*$ # followed by any number of tabs or spaces, followed by the end of the line 24 | ) 25 | block_quote: (?:[ ]{,3}>(?:.|$)) # between 0 and 3 spaces, followed by a greater than sign, followed by any character or the end of the line 26 | atx_heading: (?:[#]{1,6}\s*) # between 1 and 6 hashes, followed by any amount of whitespace 27 | indented_code_block: (?:[ ]{4}|\t) # 4 spaces or a tab 28 | list_item: (?:[ ]{,3}(?=\d+\.|[*+-])\d*([*+.-])\s) # between 0 and 3 spaces, followed by either: at least one integer and a full stop, or (a star, plus or dash), followed by whitespace 29 | escape: '\\[-`*_#+.!(){}\[\]\\>|~]' 30 | backticks: |- 31 | (?x: 32 | (`{4})(?![\s`])(?:[^`]+(?=`)|(?!`{4})`+(?!`))+(`{4})(?!`) # 4 backticks, followed by at least one non whitespace, non backtick character, followed by (less than 4 backticks, or at least one non backtick character) at least once, followed by exactly 4 backticks 33 | | (`{3})(?![\s`])(?:[^`]+(?=`)|(?!`{3})`+(?!`))+(`{3})(?!`) # 3 backticks, followed by at least one non whitespace, non backtick character, followed by (less than 3 backticks, or at least one non backtick character) at least once, followed by exactly 3 backticks 34 | | (`{2})(?![\s`])(?:[^`]+(?=`)|(?!`{2})`+(?!`))+(`{2})(?!`) # 2 backticks, followed by at least one non whitespace, non backtick character, followed by (less than 2 backticks, or at least one non backtick character) at least once, followed by exactly 2 backticks 35 | | (`{1})(?![\s`])(?:[^`]+(?=`)|(?!`{1})`+(?!`))+(`{1})(?!`) # 1 backtick, followed by at least one non whitespace, non backtick character, followed by ( at least one non backtick character) at least once, followed by exactly 1 backtick 36 | ) 37 | balance_square_brackets: |- 38 | (?x: 39 | (?: 40 | {{escape}}+ # escape characters 41 | | [^\[\]`\\]+(?=[\[\]`\\]|$) # anything that isn't a square bracket or a backtick or the start of an escape character 42 | | {{backticks}} # inline code 43 | | \[(?: # nested square brackets (one level deep) 44 | [^\[\]`]+(?=[\[\]`]) # anything that isn't a square bracket or a backtick 45 | {{backticks}}? # balanced backticks 46 | )*\] # closing square bracket 47 | )+ # at least one character 48 | ) 49 | html_entity: '&([a-zA-Z0-9]+|#\d+|#x\h+);' 50 | skip_html_tags: (?:<[^>]+>) 51 | balance_square_brackets_and_emphasis: |- 52 | (?x: 53 | (?: 54 | {{escape}}+ # escape characters 55 | | [^\[\]`\\_*]+(?=[\[\]`\\_*]|$) # anything that isn't a square bracket, a backtick, the start of an escape character, or an emphasis character 56 | | {{backticks}} # inline code 57 | | \[(?: # nested square brackets (one level deep) 58 | [^\[\]`]+(?=[\[\]`]) # anything that isn't a square bracket or a backtick 59 | {{backticks}}? # balanced backticks 60 | )*\] # closing square bracket 61 | )+ # at least one character 62 | ) 63 | balance_square_brackets_pipes_and_emphasis: |- 64 | (?x: 65 | (?: 66 | {{escape}}+ # escape characters 67 | | [^\[\]`\\_*|]+(?=[\[\]`\\_*|]|$) # anything that isn't a square bracket, a backtick, the start of an escape character, or an emphasis character 68 | | {{backticks}} # inline code 69 | | \[(?: # nested square brackets (one level deep) 70 | [^\[\]`]+(?=[\[\]`]) # anything that isn't a square bracket or a backtick 71 | {{backticks}}? # balanced backticks 72 | )*\] # closing square bracket 73 | )+ # at least one character 74 | ) 75 | balanced_emphasis: |- 76 | (?x: 77 | \* (?!\*){{balance_square_brackets_and_emphasis}}+\* (?!\*) 78 | | \*\* {{balance_square_brackets_and_emphasis}}+\*\* 79 | | _ (?!_) {{balance_square_brackets_and_emphasis}}+_ (?!_) 80 | | __ {{balance_square_brackets_and_emphasis}}+__ 81 | ) 82 | balanced_table_cell: |- # Pipes inside other inline spans (such as emphasis, code, etc.) will not break a cell, emphasis in table cells can't span multiple lines 83 | (?x: 84 | (?: 85 | {{balance_square_brackets_pipes_and_emphasis}} 86 | | {{balanced_emphasis}} 87 | )+ # at least one character 88 | ) 89 | table_first_row: |- 90 | (?x: 91 | (?:{{balanced_table_cell}}?\|){2} # at least 2 non-escaped pipe chars on the line 92 | | (?!\s+\|){{balanced_table_cell}}\|(?!\s+$) # something other than whitespace followed by a pipe char, followed by something other than whitespace and the end of the line 93 | ) 94 | fenced_code_block_start: |- 95 | (?x: 96 | ([ \t]*) 97 | ( 98 | (`){3,} # 3 or more backticks 99 | (?![^`]*`) # not followed by any more backticks on the same line 100 | | # or 101 | (~){3,} # 3 or more tildas 102 | (?![^~]*~) # not followed by any more tildas on the same line 103 | ) 104 | \s* # allow for whitespace between code block start and info string 105 | ) 106 | fenced_code_block_trailing_infostring_characters: |- 107 | (?x: 108 | ( 109 | \s* # any whitespace, or .. 110 | | 111 | \s[^`]* # any characters (except backticks), separated by whitespace ... 112 | ) 113 | $\n? # ... until EOL 114 | ) 115 | code_fence_escape: |- 116 | (?x: 117 | ^ # the beginning of the line 118 | [ \t]* 119 | ( 120 | \2 # the backtick/tilde combination that opened the code fence 121 | (?:\3|\4)* # plus optional additional closing characters 122 | ) 123 | \s*$ # any amount of whitespace until EOL 124 | ) 125 | html_tag_open_commonmark: |- 126 | (?xi: 127 | < 128 | [a-z] # A tag name consists of an ASCII letter 129 | [a-z0-9-]* # followed by zero or more ASCII letters, digits, or hyphens (-) 130 | (?: # An attribute consists of whitespace, an attribute name, and an optional attribute value specification 131 | \s+ 132 | [a-z_:] # An attribute name consists of an ASCII letter, _, or : 133 | [a-z0-9_.:-]* # followed by zero or more ASCII letters, digits, _, ., :, or - 134 | (?: # An attribute value specification consists of optional whitespace, a = character, optional whitespace, and an attribute value 135 | \s* 136 | = 137 | \s* 138 | (?: 139 | [^ @'=<>`]+ # An unquoted attribute value is a nonempty string of characters not including spaces, ", ', =, <, >, or ` 140 | | '[^']*' # A single-quoted attribute value consists of ', zero or more characters not including ', and a final ' 141 | | "[^"]*" # A double-quoted attribute value consists of ", zero or more characters not including ", and a final " 142 | ) 143 | )? 144 | )* 145 | \s* 146 | /? 147 | > 148 | ) 149 | html_tag_close_commonmark: |- 150 | (?xi: 151 | 156 | ) 157 | html_tag_block_end_at_close_tag: |- 158 | (?xi: 159 | (script|style|pre)\b 160 | ) 161 | html_tag_block_end_at_blank_line: |- 162 | (?x: 163 | /? 164 | (?i:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul) 165 | (?:\s|$|/?>) 166 | ) 167 | ascii_space: '\t\n\f ' 168 | tag_attribute_name_start: (?=[^{{ascii_space}}=/>}]) 169 | tag_attribute_name_break: (?=[{{ascii_space}}=/>}]) 170 | tag_unquoted_attribute_start: (?=[^{{ascii_space}}=/>}]) 171 | tag_unquoted_attribute_break: (?=[{{ascii_space}}}]|/?>) 172 | # code_fence_escape: |- 173 | # (?x: 174 | # ^ # the beginning of the line 175 | # [ ]{0,3} # up to 3 spaces 176 | # (\1) # the backtick/tilde combination that opened the code fence 177 | # \s*$ # any amount of whitespace until EOL 178 | # ) 179 | contexts: 180 | main: 181 | - match: (?=^\s*(?:---|\+\+\+)\s*$) 182 | push: front-matter 183 | - match: "" 184 | set: body 185 | front-matter: 186 | - match: ^\s*(---)\s*$ 187 | captures: 188 | 1: punctuation.definition.frontmatter 189 | embed: scope:source.yaml 190 | embed_scope: markup.raw.yaml.front-matter 191 | escape: ^\s*(---)\s*$ 192 | escape_captures: 193 | 1: punctuation.definition.frontmatter 194 | - match: ^\s*(\+\+\+)\s*$ 195 | captures: 196 | 1: punctuation.definition.frontmatter 197 | embed: scope:source.toml 198 | embed_scope: markup.raw.toml.front-matter 199 | escape: ^\s*(\+\+\+)\s*$ 200 | escape_captures: 201 | 1: punctuation.definition.frontmatter 202 | - match: "" 203 | pop: true 204 | set: body 205 | body: 206 | - match: |- 207 | (?x)^ 208 | (?= {{block_quote}} 209 | | {{indented_code_block}}(?!$) 210 | | {{atx_heading}} 211 | | {{thematic_break}} 212 | | {{table_first_row}} 213 | ) 214 | comment: | 215 | We could also use an empty end match and set 216 | applyEndPatternLast, but then we must be sure that the begin 217 | pattern will only match stuff matched by the sub-patterns. 218 | push: 219 | - meta_scope: meta.block-level.markdown 220 | - include: ligatures 221 | - include: block-quote 222 | - include: indented-code-block 223 | - include: atx-heading 224 | - include: thematic-break 225 | - include: table 226 | - match: '' 227 | pop: true 228 | - match: '^([ ]{0,3})([*+-])(?=\s)' 229 | captures: 230 | 1: markup.list.unnumbered.markdown 231 | 2: markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown 232 | push: 233 | - meta_content_scope: markup.list.unnumbered.markdown 234 | - match: ^(?=\S) 235 | pop: true 236 | - include: list-paragraph 237 | - match: '^([ ]{0,3})(\d+(\.))(?=\s)' 238 | captures: 239 | 1: markup.list.numbered.markdown 240 | 2: markup.list.numbered.bullet.markdown 241 | 3: punctuation.definition.list_item.markdown 242 | push: 243 | - meta_content_scope: markup.list.numbered.markdown 244 | - match: ^(?=\S) 245 | pop: true 246 | - include: list-paragraph 247 | - match: '^[ ]{0,3}(?=<((?i:pre))\b)' 248 | comment: Markdown formatting is disabled inside block-level tags. 249 | push: [disabled-markdown-pop-at-eol, disable-markdown-pop-at-tag] 250 | - match: '^[ ]{0,3}(?=<{{html_tag_block_end_at_close_tag}})' 251 | comment: Markdown formatting is disabled inside block-level tags. 252 | push: [disabled-markdown-pop-at-eol, disable-markdown-pop-after-tag] 253 | - match: '^[ ]{0,3}(?=<\?)' 254 | comment: Markdown formatting is disabled inside preprocessor instructions. 255 | push: [disabled-markdown-pop-at-eol, disable-markdown-pop-at-php] 256 | - match: '^[ ]{0,3}(?=]+)(>) # The url 288 | | (\S+) # The url 289 | ) 290 | ) 291 | captures: 292 | 1: punctuation.definition.constant.begin.markdown 293 | 2: entity.name.reference.link.markdown 294 | 3: punctuation.definition.constant.end.markdown 295 | 4: punctuation.separator.key-value.markdown 296 | 5: punctuation.definition.link.begin.markdown 297 | 6: markup.underline.link.markdown 298 | 7: punctuation.definition.link.end.markdown 299 | 8: markup.underline.link.markdown 300 | push: [link-ref-def, after-link-title, link-title] 301 | - match: '^(?=\S)(?![=-]{3,}\s*$)' 302 | push: 303 | - meta_scope: meta.paragraph.markdown 304 | - match: |- 305 | (?x) # pop out of this context when one of the following conditions are met: 306 | ^(?: 307 | \s*$ # the line is blank (or only contains whitespace) 308 | | (?= 309 | {{block_quote}} # a block quote begins the line 310 | | [ ]{,3}[*+-][ ] # an unordered list item begins the line 311 | | [ ]{,3}1[.][ ] # an ordered list item with number "1" begins the line 312 | | \# # an ATX heading begins the line 313 | | [ ]{,3}<( # all types of HTML blocks except type 7 may interrupt a paragraph 314 | {{html_tag_block_end_at_close_tag}} # 1 315 | | !-- # 2 316 | | \? # 3 317 | | ![A-Z] # 4 318 | | !\[CDATA\[ # 5 319 | | {{html_tag_block_end_at_blank_line}} # 6 320 | ) 321 | ) 322 | ) 323 | pop: true 324 | - include: inline-bold-italic-linebreak 325 | - include: scope:text.html.basic 326 | - match: '^(={3,})(?=[ \t]*$)' 327 | scope: markup.heading.1.setext.markdown 328 | captures: 329 | 1: punctuation.definition.heading.setext.markdown 330 | pop: true 331 | - match: '^(-{3,})(?=[ \t]*$)' 332 | scope: markup.heading.2.setext.markdown 333 | captures: 334 | 1: punctuation.definition.heading.setext.markdown 335 | pop: true 336 | link-ref-def: 337 | - meta_scope: meta.link.reference.def.markdown 338 | - match: '' 339 | pop: true 340 | ampersand: 341 | - match: (?!{{html_entity}})& 342 | comment: | 343 | Markdown will convert this for us. We match it so that the 344 | HTML grammar will not mark it up as invalid. 345 | scope: meta.other.valid-ampersand.markdown 346 | ligatures: 347 | - match: '<=>' # <=> 348 | - match: '<[-=<]' # <- <= << 349 | block-quote: 350 | - match: '[ ]{,3}(>)[ ]?' 351 | comment: | 352 | We terminate the block quote when seeing an empty line, a 353 | separator or a line with leading > characters. The latter is 354 | to “reset” the quote level for quoted lines. 355 | The idea here is to match block level elements first, then once 356 | we have confirmed there are no block level elements left, move to 357 | matching inline markdown. This prevents block level elements being 358 | detected when they shouldn't be. 359 | captures: 360 | 1: punctuation.definition.blockquote.markdown 361 | push: 362 | - meta_scope: markup.quote.markdown 363 | - match: |- 364 | (?x)^ 365 | (?= \s*$ 366 | | {{thematic_break}} 367 | | {{block_quote}} 368 | ) 369 | pop: true 370 | - match: |- 371 | (?x) 372 | (?= {{block_quote}} 373 | ) 374 | push: 375 | - match: ^ 376 | pop: true 377 | - include: block-quote 378 | - match: |- 379 | (?x) 380 | (?= {{indented_code_block}} 381 | | {{atx_heading}} 382 | | {{thematic_break}} 383 | | {{list_item}} 384 | ) 385 | push: 386 | - include: indented-code-block 387 | - include: atx-heading 388 | - include: thematic-break 389 | - match: ([ ]{,3})(\d+)(\.)(\s) 390 | captures: 391 | 1: markup.list.numbered.markdown 392 | 2: markup.list.numbered.bullet.markdown 393 | 3: markup.list.numbered.bullet.markdown punctuation.definition.list_item.markdown 394 | 4: markup.list.numbered.markdown 395 | push: 396 | - meta_content_scope: markup.list.numbered.markdown meta.paragraph.list.markdown 397 | - include: list-content 398 | - match: ([ ]{,3})([*+-])(\s) 399 | captures: 400 | 1: markup.list.unnumbered.markdown 401 | 2: markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown 402 | 3: markup.list.unnumbered.markdown 403 | push: 404 | - meta_content_scope: markup.list.unnumbered.markdown meta.paragraph.list.markdown 405 | - include: list-content 406 | - match: ^ 407 | pop: true 408 | - include: list-paragraph 409 | - match: '' 410 | push: 411 | - match: $|^ 412 | pop: true 413 | - include: inline-bold-italic-linebreak 414 | indented-code-block: 415 | - match: '{{indented_code_block}}.*$\n?' 416 | scope: markup.raw.block.markdown 417 | bold: 418 | - include: ligatures 419 | - match: '(\*\*)(\*)(?=\S)(?!\*)' 420 | captures: 421 | 1: punctuation.definition.bold.begin.markdown 422 | 2: markup.italic.markdown punctuation.definition.italic.begin.markdown 423 | push: 424 | - meta_scope: markup.bold.markdown 425 | - meta_content_scope: markup.italic.markdown 426 | - match: |- 427 | (?x) 428 | [ \t]*\*{4,} # if there are more than 3 its not applicable to be bold or italic 429 | | [ \t]+\*(?!\*) # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) 430 | | ^\*(?!\*) # emphasis can't be closed at the start of the line 431 | - match: (\*)(\*\*) 432 | captures: 433 | 1: markup.italic.markdown punctuation.definition.italic.end.markdown 434 | 2: punctuation.definition.bold.end.markdown 435 | pop: true 436 | - match: \*\* 437 | scope: punctuation.definition.bold.end.markdown 438 | set: 439 | - meta_content_scope: markup.italic.markdown 440 | - match: |- 441 | (?x) 442 | [ \t]*\*{3,} # if there are more than 3 its not applicable to be bold or italic 443 | | [ \t]+\*\*+ # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) 444 | | ^\*\* # emphasis can't be closed at the start of the line 445 | - match: \* 446 | scope: markup.italic.markdown punctuation.definition.italic.end.markdown 447 | pop: true 448 | - include: inline 449 | - include: bold 450 | - include: supersubscript 451 | - include: bold-italic-trailing 452 | - match: \* 453 | scope: punctuation.definition.italic.end.markdown 454 | set: 455 | - meta_content_scope: markup.bold.markdown 456 | - match: |- 457 | (?x) 458 | [ \t]*\*{3,} # if there are more than 3 its not applicable to be bold or italic 459 | | [ \t]+\*\*+ # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) 460 | | ^\*\* # emphasis can't be closed at the start of the line 461 | - match: \*\* 462 | scope: markup.bold.markdown punctuation.definition.bold.end.markdown 463 | pop: true 464 | - include: inline 465 | - include: italic 466 | - include: supersubscript 467 | - include: bold-italic-trailing 468 | - include: inline 469 | - include: bold-italic-trailing 470 | - match: '\*\*(?=\S)(?!\*\*|\*\s)' 471 | scope: punctuation.definition.bold.begin.markdown 472 | push: 473 | - meta_scope: markup.bold.markdown 474 | - match: |- 475 | (?x) 476 | [ \t]*\*{4,} # if there are more than 3 its not applicable to be bold or italic 477 | | [ \t]+\*\*+ # whitespace followed by 2 or more is also not applicable 478 | | ^\*\* # emphasis can't be closed at the start of the line 479 | - match: (?:_)?(\*\*) 480 | captures: 481 | 1: punctuation.definition.bold.end.markdown 482 | pop: true 483 | - include: inline 484 | - match: \b_(?=[^\s_])(?=[^*_]*\*\*) 485 | comment: eat the underscore that has no corresponding underscore before the closing bold punctuation on the same line, as it won't be treated as italic by CommonMark 486 | - include: italic 487 | - include: supersubscript 488 | - include: bold-italic-trailing 489 | - match: '\b(__)(_)(?=\S)(?!_)' 490 | captures: 491 | 1: punctuation.definition.bold.begin.markdown 492 | 2: markup.italic.markdown punctuation.definition.italic.begin.markdown 493 | push: 494 | - meta_scope: markup.bold.markdown 495 | - meta_content_scope: markup.italic.markdown 496 | - match: |- 497 | (?x) 498 | [ \t]*_{4,} # if there are more than 3 its not applicable to be bold or italic 499 | | [ \t]+_(?!_) # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) 500 | | ^_(?!_) # emphasis can't be closed at the start of the line 501 | - match: (_)(__)\b 502 | captures: 503 | 1: markup.italic.markdown punctuation.definition.italic.end.markdown 504 | 2: punctuation.definition.bold.end.markdown 505 | pop: true 506 | - match: _\b 507 | scope: punctuation.definition.italic.end.markdown 508 | set: 509 | - meta_content_scope: markup.bold.markdown 510 | - match: |- 511 | (?x) 512 | [ \t]*_{3,} # if there are more than 3 its not applicable to be bold or italic 513 | | [ \t]+__+ # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) 514 | | ^__ # emphasis can't be closed at the start of the line 515 | - match: __\b 516 | scope: markup.bold.markdown punctuation.definition.bold.end.markdown 517 | pop: true 518 | - include: inline 519 | - include: italic 520 | - include: supersubscript 521 | - include: bold-italic-trailing 522 | - match: __\b 523 | scope: punctuation.definition.bold.end.markdown 524 | set: 525 | - meta_content_scope: markup.italic.markdown 526 | - match: |- 527 | (?x) 528 | [ \t]*_{3,} # if there are more than 3 its not applicable to be bold or italic 529 | | [ \t]+__+ # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) 530 | | ^__ # emphasis can't be closed at the start of the line 531 | - match: _\b 532 | scope: markup.italic.markdown punctuation.definition.italic.end.markdown 533 | pop: true 534 | - include: inline 535 | - include: bold 536 | - include: supersubscript 537 | - include: bold-italic-trailing 538 | - include: inline 539 | - include: bold-italic-trailing 540 | - match: '\b__(?=\S)(?!_[_\s])' 541 | scope: punctuation.definition.bold.begin.markdown 542 | push: 543 | - meta_scope: markup.bold.markdown 544 | - match: |- 545 | (?x) 546 | [ \t]*_{4,} # if there are more than 3 its not applicable to be bold or italic 547 | | [ \t]+__+ # whitespace followed by 2 or more is also not applicable 548 | | ^__ # emphasis can't be closed at the start of the line 549 | - match: (?:\*)?(__\b) 550 | captures: 551 | 1: punctuation.definition.bold.end.markdown 552 | pop: true 553 | - include: inline 554 | - match: \*(?=[^\s*])(?=[^*_]*__\b) 555 | comment: eat the asterisk that has no corresponding asterisk before the closing bold punctuation on the same line, as it won't be treated as italic by CommonMark 556 | - include: italic 557 | - include: supersubscript 558 | - include: bold-italic-trailing 559 | bracket: 560 | - match: '<(?![A-Za-z/?!$])' 561 | comment: | 562 | Markdown will convert this for us. We match it so that the 563 | HTML grammar will not mark it up as invalid. 564 | scope: meta.other.valid-bracket.markdown 565 | escape: 566 | - match: '{{escape}}' 567 | scope: constant.character.escape.markdown 568 | atx-heading-terminator: 569 | - match: '[ ]*(#*)[ ]*($\n?)' # \n is optional so ## is matched as end punctuation in new document (at eof) 570 | captures: 571 | 1: punctuation.definition.heading.end.markdown 572 | 2: meta.whitespace.newline.markdown 573 | pop: true 574 | atx-heading: 575 | - match: '(#)(?!#)\s*(?=\S)' 576 | captures: 577 | 1: punctuation.definition.heading.begin.markdown 578 | push: 579 | - meta_scope: markup.heading.1.markdown 580 | - meta_content_scope: entity.name.section.markdown 581 | - include: atx-heading-terminator 582 | - include: inline-bold-italic 583 | - match: '(##)(?!#)\s*(?=\S)' 584 | captures: 585 | 1: punctuation.definition.heading.begin.markdown 586 | push: 587 | - meta_scope: markup.heading.2.markdown 588 | - meta_content_scope: entity.name.section.markdown 589 | - include: atx-heading-terminator 590 | - include: inline-bold-italic 591 | - match: '(#{3,6})(?!#)\s*(?=\S)' 592 | captures: 593 | 1: punctuation.definition.heading.begin.markdown 594 | push: 595 | - meta_scope: markup.heading.markdown 596 | - meta_content_scope: entity.name.section.markdown 597 | - include: atx-heading-terminator 598 | - include: inline-bold-italic 599 | image-inline: 600 | - match: |- 601 | (?x: 602 | (\!\[) # Images start with ![ 603 | (?= {{balance_square_brackets}}? # balanced square brackets, backticks, taking into account escapes etc. 604 | \] # Closing square bracket 605 | [ ]? # Space not allowed, but we check for it anyway to mark it as invalid 606 | \( # Open paren 607 | ) 608 | ) 609 | captures: 610 | 1: meta.image.inline.markdown punctuation.definition.image.begin.markdown 611 | push: [image-inline-attr, image-inline-after-text, image-link-text] 612 | image-link-text: 613 | - meta_content_scope: meta.image.inline.description.markdown 614 | - include: link-text 615 | - match: \] 616 | scope: meta.image.inline.markdown punctuation.definition.image.end.markdown 617 | pop: true 618 | image-inline-after-text: 619 | - match: '([ ]*)(\()' # spaces not allowed before the open paren, but we check for it anyway to mark it as invalid 620 | captures: 621 | 1: invalid.illegal.whitespace.markdown 622 | 2: punctuation.definition.metadata.begin.markdown 623 | set: 624 | - meta_scope: meta.image.inline.markdown 625 | - match: \) 626 | scope: punctuation.definition.metadata.end.markdown 627 | pop: true 628 | - match: <(?=[^>)]*>) 629 | scope: punctuation.definition.link.begin.markdown 630 | push: 631 | - meta_content_scope: markup.underline.link.image.markdown 632 | - match: \> 633 | scope: punctuation.definition.link.end.markdown 634 | set: link-title 635 | - match: \s+ 636 | scope: invalid.illegal.unexpected-whitespace.markdown 637 | - match: (?=\S) 638 | set: 639 | - meta_scope: meta.image.inline.markdown 640 | - match: '[^\s)]+' 641 | scope: markup.underline.link.image.markdown 642 | - match: \) 643 | scope: punctuation.definition.metadata.end.markdown 644 | pop: true 645 | - match: (?!\n)\s+(?!\s*(?:[)('"]|$)) 646 | scope: invalid.illegal.unexpected-whitespace.markdown 647 | - match: (?=\s*(?!\))) 648 | push: link-title 649 | image-inline-attr: 650 | - match: '([ ]*)(\{)(?=[^}]*\})' 651 | captures: 652 | 1: invalid.illegal.whitespace.markdown 653 | 2: punctuation.definition.attributes.begin.markdown 654 | set: 655 | - meta_scope: meta.image.inline.markdown 656 | - include: tag-attributes 657 | - include: immediately-pop 658 | image-ref: 659 | - match: |- 660 | (?x: 661 | (\!\[) # Images start with ![ 662 | (?= {{balance_square_brackets}}? # balanced square brackets, backticks, taking into account escapes etc. 663 | \] # Closing square bracket 664 | [ ]? # Space 665 | \[ # [ 666 | [^\]]+ # anything other than ] 667 | \] # ] 668 | ) 669 | ) 670 | captures: 671 | 1: meta.image.reference.markdown punctuation.definition.image.begin.markdown 672 | push: [image-ref-attr, image-ref-after-text, image-ref-text] 673 | image-ref-text: 674 | - meta_content_scope: meta.image.reference.description.markdown 675 | - include: link-text 676 | - match: \] 677 | scope: meta.image.reference.markdown punctuation.definition.image.end.markdown 678 | pop: true 679 | image-ref-after-text: 680 | - match: '[ ]?(\[)([^\]]+)(\])' 681 | captures: 682 | 1: punctuation.definition.constant.begin.markdown 683 | 2: constant.other.reference.link.markdown 684 | 3: punctuation.definition.constant.end.markdown 685 | scope: meta.image.reference.markdown 686 | pop: true 687 | image-ref-attr: 688 | - match: '([ ]*)(\{)(?=[^}]*\})' 689 | captures: 690 | 1: invalid.illegal.whitespace.markdown 691 | 2: punctuation.definition.attributes.begin.markdown 692 | set: 693 | - meta_scope: meta.image.reference.markdown 694 | - include: tag-attributes 695 | - include: immediately-pop 696 | inline: 697 | - include: escape 698 | - include: ampersand 699 | - include: ligatures 700 | - include: bracket 701 | - include: latex-math 702 | - include: raw 703 | - include: image-inline 704 | - include: link-inline 705 | - include: autolink-inet 706 | - include: autolink-email 707 | - include: image-ref 708 | - include: link-ref-literal 709 | - include: link-ref 710 | - include: link-ref-footnote 711 | - include: citations 712 | inline-bold-italic: 713 | - include: inline 714 | - include: bold 715 | - include: italic 716 | - include: strikethrough 717 | - include: supersubscript 718 | inline-bold-italic-linebreak: 719 | - include: inline-bold-italic 720 | - include: hard-line-break 721 | italic: 722 | - match: '\*(?=\S)(?!\*)' 723 | scope: punctuation.definition.italic.begin.markdown 724 | push: 725 | - meta_scope: markup.italic.markdown 726 | - match: |- 727 | (?x) 728 | [ \t]*\*{4,} # if there are more than 3 its not applicable to be bold or italic 729 | | [ \t]+\*(?!\*) # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) 730 | | ^\*(?!\*) # emphasis can't be closed at the start of the line 731 | - match: \*(?!\*[^*]) 732 | scope: punctuation.definition.italic.end.markdown 733 | pop: true 734 | - include: inline 735 | - include: bold 736 | - include: supersubscript 737 | - match: '\*+' 738 | - include: bold-italic-trailing 739 | - match: '\b_(?=\S)(?!_)' 740 | scope: punctuation.definition.italic.begin.markdown 741 | push: 742 | - meta_scope: markup.italic.markdown 743 | - match: |- 744 | (?x) 745 | [ \t]*_{4,} # if there are more than 3 its not applicable to be bold or italic 746 | | [ \t]+_(?!_) # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) 747 | | ^_(?!_) # emphasis can't be closed at the start of the line 748 | - match: _\b 749 | scope: punctuation.definition.italic.end.markdown 750 | pop: true 751 | - include: inline 752 | - include: bold 753 | - include: supersubscript 754 | - include: bold-italic-trailing 755 | - match: '[*_]+' 756 | supersubscript: 757 | - match: '(~)(?=([^~ \n]|\\ )+~)' 758 | scope: punctuation.definition.subscript.begin.markdown 759 | push: 760 | - meta_scope: markup.subscript.markdown-pandoc 761 | - match: '~' 762 | scope: punctuation.definition.subscript.end.markdown 763 | pop: true 764 | - include: inline 765 | - include: bold 766 | - include: italic 767 | - include: bold-italic-trailing 768 | - match: '(\^)(?=([^\^ \n]|\\ )+\^)' 769 | scope: punctuation.definition.superscript.begin.markdown 770 | push: 771 | - meta_scope: markup.superscript.markdown-pandoc 772 | - match: \^ 773 | scope: punctuation.definition.superscript.end.markdown 774 | pop: true 775 | - include: inline 776 | - include: bold 777 | - include: italic 778 | - include: bold-italic-trailing 779 | strikethrough: 780 | - match: '(~~+)(?=\S)(?!~)' 781 | scope: punctuation.definition.strikethrough.begin.markdown 782 | push: 783 | - meta_scope: markup.strikethrough.markdown-gfm 784 | - match: ~~+ 785 | scope: punctuation.definition.strikethrough.end.markdown 786 | pop: true 787 | - include: inline 788 | - include: bold 789 | - include: italic 790 | - include: supersubscript 791 | - include: bold-italic-trailing 792 | bold-italic-trailing: 793 | - include: scope:text.html.basic 794 | - match: ^\s*$\n? 795 | scope: invalid.illegal.non-terminated.bold-italic.markdown 796 | pop: true 797 | - match: '^(?={{list_item}})' 798 | pop: true 799 | - include: hard-line-break 800 | hard-line-break: 801 | - match: '[ ]{2,}$' 802 | scope: meta.hard-line-break.markdown punctuation.definition.hard-line-break.markdown 803 | - match: '(\\)$\n' 804 | scope: meta.hard-line-break.markdown 805 | captures: 806 | 1: constant.character.escape.markdown 807 | autolink-email: 808 | - match: '(<)((?:mailto:)?[-+.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(>)' 809 | scope: meta.link.email.lt-gt.markdown 810 | captures: 811 | 1: punctuation.definition.link.begin.markdown 812 | 2: markup.underline.link.markdown 813 | 4: punctuation.definition.link.end.markdown 814 | - match: '[\w.+-]+@[\w-]+(\.((?![._-][\W])[\w_-])+)+(?![_-])' 815 | scope: markup.underline.link.markdown 816 | autolink-inet: 817 | - match: (<)((?:https?|ftp)://.*?)(>) 818 | scope: meta.link.inet.markdown 819 | captures: 820 | 1: punctuation.definition.link.begin.markdown 821 | 2: markup.underline.link.markdown 822 | 3: punctuation.definition.link.end.markdown 823 | - match: (((https|http|ftp)://)|www\.)[\w-]+(\.[\w-]+)+ 824 | scope: markup.underline.link.markdown-gfm 825 | push: # After a valid domain, zero or more non-space non-< characters may follow 826 | - match: (?=[?!.,:*_~]*[\s<]) # Trailing punctuation (specifically, ?, !, ., ,, :, *, _, and ~) will not be considered part of the autolink, though they may be included in the interior of the link 827 | pop: true 828 | - match: (?={{html_entity}}[?!.,:*_~]*[\s<]) # If an autolink ends in a semicolon (;), we check to see if it appears to resemble an entity reference; if the preceding text is & followed by one or more alphanumeric characters. If so, it is excluded from the autolink 829 | pop: true 830 | - match: \( # When an autolink ends in ), we scan the entire autolink for the total number of parentheses. If there is a greater number of closing parentheses than opening ones, we don’t consider the last character part of the autolink, in order to facilitate including an autolink inside a parenthesis 831 | push: 832 | - meta_scope: markup.underline.link.markdown-gfm 833 | - match: (?=[?!.,:*_~]*[\s<]) 834 | pop: true 835 | - match: \) 836 | pop: true 837 | - match: (?=\)[?!.,:*_~]*[\s<]) 838 | pop: true 839 | - match: '[^?!.,:*_~\s<&()]+|\S' 840 | scope: markup.underline.link.markdown-gfm 841 | link-inline: 842 | - match: |- 843 | (?x: 844 | (\[) 845 | (?= 846 | {{balance_square_brackets}}? 847 | \] 848 | [ ]?\( 849 | ) 850 | ) 851 | captures: 852 | 1: meta.link.inline.markdown punctuation.definition.link.begin.markdown 853 | push: [link-inline-attr, link-inline-after-text, link-inline-link-text] 854 | link-inline-after-text: 855 | - match: '([ ]*)(\()' # spaces not allowed before the open paren, but we check for it anyway to mark it as invalid 856 | captures: 857 | 1: invalid.illegal.whitespace.markdown 858 | 2: punctuation.definition.metadata.begin.markdown 859 | set: 860 | - meta_scope: meta.link.inline.markdown 861 | - match: \) 862 | scope: punctuation.definition.metadata.end.markdown 863 | pop: true 864 | - match: <(?=[^>)]*>) 865 | scope: punctuation.definition.link.begin.markdown 866 | push: 867 | - match: \> 868 | scope: punctuation.definition.link.end.markdown 869 | set: link-title 870 | - match: \s+ 871 | scope: invalid.illegal.unexpected-whitespace.markdown 872 | - match: (?=\S) 873 | set: 874 | - meta_scope: meta.link.inline.markdown 875 | - match: '[^\s)]+' 876 | scope: markup.underline.link.markdown 877 | - match: \) 878 | scope: punctuation.definition.metadata.end.markdown 879 | pop: true 880 | - match: (?!\n)\s+(?!\s*(?:[)('"]|$)) 881 | scope: invalid.illegal.unexpected-whitespace.markdown 882 | - match: (?=\s*(?!\))) 883 | push: link-title 884 | link-inline-attr: 885 | - match: '([ ]*)(\{)(?=[^}]*\})' 886 | captures: 887 | 1: invalid.illegal.whitespace.markdown 888 | 2: punctuation.definition.attributes.begin.markdown 889 | set: 890 | - meta_scope: meta.link.inline.markdown 891 | - include: tag-attributes 892 | - include: immediately-pop 893 | link-inline-link-text: 894 | - meta_content_scope: meta.link.inline.description.markdown 895 | - include: link-text-allow-image 896 | - match: \] 897 | scope: meta.link.inline.markdown punctuation.definition.link.end.markdown 898 | pop: true 899 | link-ref: 900 | - match: |- 901 | (?x: 902 | (\[) 903 | (?= {{balance_square_brackets}}? # balanced square brackets, backticks, taking into account escapes etc. 904 | \] # Closing square bracket 905 | [ ]? # Space 906 | \[ # [ 907 | [^\]]+ # anything other than ] 908 | \] # ] 909 | ) 910 | ) 911 | captures: 912 | 1: meta.link.reference.markdown punctuation.definition.link.begin.markdown 913 | push: [link-ref-attr, link-ref-after-text, link-ref-link-text] 914 | link-ref-link-text: 915 | - meta_content_scope: meta.link.reference.description.markdown 916 | - include: link-text-allow-image 917 | - match: \] 918 | scope: meta.link.reference.markdown punctuation.definition.link.end.markdown 919 | pop: true 920 | link-ref-after-text: 921 | - match: '[ ]?(\[)([^\]]+)(\])' 922 | captures: 923 | 1: punctuation.definition.constant.begin.markdown 924 | 2: constant.other.reference.link.markdown 925 | 3: punctuation.definition.constant.end.markdown 926 | scope: meta.link.reference.markdown 927 | pop: true 928 | link-ref-attr: 929 | - match: '([ ]*)(\{)(?=[^}]*\})' 930 | captures: 931 | 1: invalid.illegal.whitespace.markdown 932 | 2: punctuation.definition.attributes.begin.markdown 933 | set: 934 | - meta_scope: meta.link.reference.markdown 935 | - include: tag-attributes 936 | - include: immediately-pop 937 | link-ref-literal: 938 | - match: |- 939 | (?x: 940 | (\[) 941 | (?= 942 | {{balance_square_brackets}}? # balanced square brackets, backticks, taking into account escapes etc. 943 | \] # Closing square bracket 944 | [ ]? # Space 945 | \[ # [ 946 | \] # ] 947 | ) 948 | ) 949 | captures: 950 | 1: meta.link.reference.literal.markdown punctuation.definition.link.begin.markdown 951 | push: [link-ref-literal-attr, link-ref-literal-after-text, link-ref-literal-link-text] 952 | link-ref-literal-link-text: 953 | - meta_content_scope: meta.link.reference.literal.description.markdown 954 | - include: link-text-allow-image 955 | - match: \] 956 | scope: meta.link.reference.literal.markdown punctuation.definition.link.end.markdown 957 | pop: true 958 | link-ref-literal-after-text: 959 | - match: '[ ]?(\[)(\])' 960 | scope: meta.link.reference.literal.markdown 961 | captures: 962 | 1: punctuation.definition.constant.begin.markdown 963 | 2: punctuation.definition.constant.end.markdown 964 | pop: true 965 | link-ref-literal-attr: 966 | - match: '([ ]*)(\{)(?=[^}]*\})' 967 | captures: 968 | 1: invalid.illegal.whitespace.markdown 969 | 2: punctuation.definition.attributes.begin.markdown 970 | set: 971 | - meta_scope: meta.link.reference.literal.markdown 972 | - include: tag-attributes 973 | - include: immediately-pop 974 | link-ref-footnote: 975 | - match: |- 976 | (?x: 977 | (\[\^) 978 | ([^]]+) 979 | (\]) 980 | ) 981 | captures: 982 | 0: meta.link.reference.footnote.markdown-extra 983 | 1: punctuation.definition.link.begin.markdown 984 | 2: meta.link.reference.literal.footnote-id.markdown 985 | 3: punctuation.definition.link.end.markdown 986 | citations: 987 | - match: '(@)([\w:-]+)' 988 | scope: meta.link.reference.markdown-pandoc 989 | captures: 990 | 1: constant.other.cite.markdown-pandoc 991 | 2: keyword.other.cite.markdown-pandoc 992 | list-paragraph: 993 | - match: '^(?=(?:[ ]{4}|\t){2,}(?![>+*\s-]))(?={{indented_code_block}})' 994 | push: 995 | - include: indented-code-block 996 | - match: $ 997 | pop: true 998 | - match: '^(?=\s+{{block_quote}})' 999 | push: 1000 | - include: block-quote 1001 | - match: $ 1002 | pop: true 1003 | - match: '^(?={{fenced_code_block_start}})' 1004 | push: 1005 | - include: fenced-code-block 1006 | - match: '' 1007 | pop: true 1008 | - match: \s+(?=\S) 1009 | push: 1010 | - match: ^\s*$ 1011 | pop: true 1012 | - match: '([ ]*)([*+-])(?=\s)' 1013 | captures: 1014 | 1: markup.list.unnumbered.markdown 1015 | 2: markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown 1016 | push: 1017 | - clear_scopes: 1 1018 | - meta_content_scope: markup.list.unnumbered.markdown meta.paragraph.list.markdown 1019 | - include: list-content 1020 | - match: '([ ]*)(\d+(\.))(?=\s)' 1021 | captures: 1022 | 1: markup.list.numbered.markdown 1023 | 2: markup.list.numbered.bullet.markdown 1024 | 3: punctuation.definition.list_item.markdown 1025 | push: 1026 | - clear_scopes: 1 1027 | - meta_content_scope: markup.list.numbered.markdown meta.paragraph.list.markdown 1028 | - include: list-content 1029 | - match: \s+ 1030 | scope: meta.paragraph.list.markdown 1031 | - match: '(?=\S)' 1032 | push: list-content 1033 | - match: '(?=\S)' 1034 | pop: true 1035 | list-content: 1036 | - meta_content_scope: meta.paragraph.list.markdown 1037 | - match: ^(?={{fenced_code_block_start}}) 1038 | push: 1039 | - match: $ 1040 | pop: true 1041 | - include: fenced-code-block 1042 | - match: ^ 1043 | pop: true 1044 | - include: thematic-break 1045 | - match: (?=\S)(?!{{list_item}}) 1046 | push: 1047 | - match: (?={{list_item}}) 1048 | pop: true 1049 | - include: inline-bold-italic-linebreak 1050 | - include: scope:text.html.basic 1051 | - match: $ 1052 | pop: true 1053 | fenced-code-block: 1054 | - match: |- 1055 | (?x) 1056 | {{fenced_code_block_start}} 1057 | ((?i:xml)) 1058 | {{fenced_code_block_trailing_infostring_characters}} 1059 | captures: 1060 | 0: meta.code-fence.definition.begin.xml.markdown-gfm 1061 | 2: punctuation.definition.raw.code-fence.begin.markdown 1062 | 5: constant.other.language-name.markdown 1063 | embed: scope:text.xml 1064 | embed_scope: markup.raw.code-fence.xml.markdown-gfm 1065 | escape: '{{code_fence_escape}}' 1066 | escape_captures: 1067 | 0: meta.code-fence.definition.end.xml.markdown-gfm 1068 | 1: punctuation.definition.raw.code-fence.end.markdown 1069 | - match: |- 1070 | (?x) 1071 | {{fenced_code_block_start}} 1072 | ((?i:sql)) 1073 | {{fenced_code_block_trailing_infostring_characters}} 1074 | captures: 1075 | 0: meta.code-fence.definition.begin.sql.markdown-gfm 1076 | 2: punctuation.definition.raw.code-fence.begin.markdown 1077 | 5: constant.other.language-name.markdown 1078 | embed: scope:source.sql 1079 | embed_scope: markup.raw.code-fence.sql.markdown-gfm 1080 | escape: '{{code_fence_escape}}' 1081 | escape_captures: 1082 | 0: meta.code-fence.definition.end.sql.markdown-gfm 1083 | 1: punctuation.definition.raw.code-fence.end.markdown 1084 | - match: |- 1085 | (?x) 1086 | {{fenced_code_block_start}} 1087 | ((?i:python|py)) 1088 | {{fenced_code_block_trailing_infostring_characters}} 1089 | captures: 1090 | 0: meta.code-fence.definition.begin.python.markdown-gfm 1091 | 2: punctuation.definition.raw.code-fence.begin.markdown 1092 | 5: constant.other.language-name.markdown 1093 | embed: scope:source.python 1094 | embed_scope: markup.raw.code-fence.python.markdown-gfm 1095 | escape: '{{code_fence_escape}}' 1096 | escape_captures: 1097 | 0: meta.code-fence.definition.end.python.markdown-gfm 1098 | 1: punctuation.definition.raw.code-fence.end.markdown 1099 | - match: |- 1100 | (?x) 1101 | {{fenced_code_block_start}} 1102 | ((?i:graphviz)) 1103 | {{fenced_code_block_trailing_infostring_characters}} 1104 | captures: 1105 | 0: meta.code-fence.definition.begin.graphviz.markdown-gfm 1106 | 2: punctuation.definition.raw.code-fence.begin.markdown 1107 | 5: constant.other.language-name.markdown 1108 | embed: scope:source.dot 1109 | embed_scope: markup.raw.code-fence.graphviz.markdown-gfm 1110 | escape: '{{code_fence_escape}}' 1111 | escape_captures: 1112 | 0: meta.code-fence.definition.end.graphviz.markdown-gfm 1113 | 1: punctuation.definition.raw.code-fence.end.markdown 1114 | - match: |- 1115 | (?x) 1116 | {{fenced_code_block_start}} 1117 | ((?i:javascript|js)) 1118 | {{fenced_code_block_trailing_infostring_characters}} 1119 | captures: 1120 | 0: meta.code-fence.definition.begin.javascript.markdown-gfm 1121 | 2: punctuation.definition.raw.code-fence.begin.markdown 1122 | 5: constant.other.language-name.markdown 1123 | embed: scope:source.js 1124 | embed_scope: markup.raw.code-fence.javascript.markdown-gfm 1125 | escape: '{{code_fence_escape}}' 1126 | escape_captures: 1127 | 0: meta.code-fence.definition.end.javascript.markdown-gfm 1128 | 1: punctuation.definition.raw.code-fence.end.markdown 1129 | - match: |- 1130 | (?x) 1131 | {{fenced_code_block_start}} 1132 | ((?i:json)) 1133 | {{fenced_code_block_trailing_infostring_characters}} 1134 | captures: 1135 | 0: meta.code-fence.definition.begin.json.markdown-gfm 1136 | 2: punctuation.definition.raw.code-fence.begin.markdown 1137 | 5: constant.other.language-name.markdown 1138 | embed: scope:source.json 1139 | embed_scope: markup.raw.code-fence.json.markdown-gfm 1140 | escape: '{{code_fence_escape}}' 1141 | escape_captures: 1142 | 0: meta.code-fence.definition.end.json.markdown-gfm 1143 | 1: punctuation.definition.raw.code-fence.end.markdown 1144 | - match: |- 1145 | (?x) 1146 | {{fenced_code_block_start}} 1147 | ((?i:java)) 1148 | {{fenced_code_block_trailing_infostring_characters}} 1149 | captures: 1150 | 0: meta.code-fence.definition.begin.java.markdown-gfm 1151 | 2: punctuation.definition.raw.code-fence.begin.markdown 1152 | 5: constant.other.language-name.markdown 1153 | embed: scope:source.java 1154 | embed_scope: markup.raw.code-fence.java.markdown-gfm 1155 | escape: '{{code_fence_escape}}' 1156 | escape_captures: 1157 | 0: meta.code-fence.definition.end.java.markdown-gfm 1158 | 1: punctuation.definition.raw.code-fence.end.markdown 1159 | - match: |- 1160 | (?x) 1161 | {{fenced_code_block_start}} 1162 | ((?i:csharp|c\#|cs)) 1163 | {{fenced_code_block_trailing_infostring_characters}} 1164 | captures: 1165 | 0: meta.code-fence.definition.begin.csharp.markdown-gfm 1166 | 2: punctuation.definition.raw.code-fence.begin.markdown 1167 | 5: constant.other.language-name.markdown 1168 | embed: scope:source.cs 1169 | embed_scope: markup.raw.code-fence.csharp.markdown-gfm 1170 | escape: '{{code_fence_escape}}' 1171 | escape_captures: 1172 | 0: meta.code-fence.definition.end.csharp.markdown-gfm 1173 | 1: punctuation.definition.raw.code-fence.end.markdown 1174 | - match: |- 1175 | (?x) 1176 | {{fenced_code_block_start}} 1177 | ((?i:rust)) 1178 | {{fenced_code_block_trailing_infostring_characters}} 1179 | captures: 1180 | 0: meta.code-fence.definition.begin.rust.markdown-gfm 1181 | 2: punctuation.definition.raw.code-fence.begin.markdown 1182 | 5: constant.other.language-name.markdown 1183 | embed: scope:source.rust 1184 | embed_scope: markup.raw.code-fence.rust.markdown-gfm 1185 | escape: '{{code_fence_escape}}' 1186 | escape_captures: 1187 | 0: meta.code-fence.definition.end.rust.markdown-gfm 1188 | 1: punctuation.definition.raw.code-fence.end.markdown 1189 | - match: |- 1190 | (?x) 1191 | {{fenced_code_block_start}} 1192 | ((?i:shell-script|sh|bash|zsh)) 1193 | {{fenced_code_block_trailing_infostring_characters}} 1194 | captures: 1195 | 0: meta.code-fence.definition.begin.shell-script.markdown-gfm 1196 | 2: punctuation.definition.raw.code-fence.begin.markdown 1197 | 5: constant.other.language-name.markdown 1198 | embed: scope:source.shell.bash 1199 | embed_scope: markup.raw.code-fence.shell-script.markdown-gfm 1200 | escape: '{{code_fence_escape}}' 1201 | escape_captures: 1202 | 0: meta.code-fence.definition.end.shell-script.markdown-gfm 1203 | 1: punctuation.definition.raw.code-fence.end.markdown 1204 | - match: |- 1205 | (?x) 1206 | {{fenced_code_block_start}} 1207 | ((?i:php|inc)) 1208 | {{fenced_code_block_trailing_infostring_characters}} 1209 | captures: 1210 | 0: meta.code-fence.definition.begin.php.markdown-gfm 1211 | 2: punctuation.definition.raw.code-fence.begin.markdown 1212 | 5: constant.other.language-name.markdown 1213 | embed: scope:source.php 1214 | embed_scope: markup.raw.code-fence.php.markdown-gfm 1215 | escape: '{{code_fence_escape}}' 1216 | escape_captures: 1217 | 0: meta.code-fence.definition.end.php.markdown-gfm 1218 | 1: punctuation.definition.raw.code-fence.end.markdown 1219 | - match: |- 1220 | (?x) 1221 | {{fenced_code_block_start}} 1222 | ((?i:html\+php)) 1223 | {{fenced_code_block_trailing_infostring_characters}} 1224 | captures: 1225 | 0: meta.code-fence.definition.begin.html-php.markdown-gfm 1226 | 2: punctuation.definition.raw.code-fence.begin.markdown 1227 | 5: constant.other.language-name.markdown 1228 | embed: scope:embedding.php 1229 | embed_scope: markup.raw.code-fence.html-php.markdown-gfm 1230 | escape: '{{code_fence_escape}}' 1231 | escape_captures: 1232 | 0: meta.code-fence.definition.end.html-php.markdown-gfm 1233 | 1: punctuation.definition.raw.code-fence.end.markdown 1234 | - match: |- 1235 | (?x) 1236 | {{fenced_code_block_start}} 1237 | ((?i:rscript|r|splus)) 1238 | {{fenced_code_block_trailing_infostring_characters}} 1239 | captures: 1240 | 0: meta.code-fence.definition.begin.r.markdown-gfm 1241 | 2: punctuation.definition.raw.code-fence.begin.markdown 1242 | 5: constant.other.language-name.markdown 1243 | embed: scope:source.r 1244 | embed_scope: markup.raw.code-fence.r.markdown-gfm 1245 | escape: '{{code_fence_escape}}' 1246 | escape_captures: 1247 | 0: meta.code-fence.definition.end.r.markdown-gfm 1248 | 1: punctuation.definition.raw.code-fence.end.markdown 1249 | - match: |- 1250 | (?x) 1251 | {{fenced_code_block_start}} 1252 | ((?i:golang)) 1253 | {{fenced_code_block_trailing_infostring_characters}} 1254 | captures: 1255 | 0: meta.code-fence.definition.begin.go.markdown-gfm 1256 | 2: punctuation.definition.raw.code-fence.begin.markdown 1257 | 5: constant.other.language-name.markdown 1258 | embed: scope:source.go 1259 | embed_scope: markup.raw.code-fence.go.markdown-gfm 1260 | escape: '{{code_fence_escape}}' 1261 | escape_captures: 1262 | 0: meta.code-fence.definition.end.go.markdown-gfm 1263 | 1: punctuation.definition.raw.code-fence.end.markdown 1264 | - match: |- 1265 | (?x) 1266 | {{fenced_code_block_start}} 1267 | ((?i:ruby|rb|rbx)) 1268 | {{fenced_code_block_trailing_infostring_characters}} 1269 | captures: 1270 | 0: meta.code-fence.definition.begin.ruby.markdown-gfm 1271 | 2: punctuation.definition.raw.code-fence.begin.markdown 1272 | 5: constant.other.language-name.markdown 1273 | embed: scope:source.ruby 1274 | embed_scope: markup.raw.code-fence.ruby.markdown-gfm 1275 | escape: '{{code_fence_escape}}' 1276 | escape_captures: 1277 | 0: meta.code-fence.definition.end.ruby.markdown-gfm 1278 | 1: punctuation.definition.raw.code-fence.end.markdown 1279 | - match: |- 1280 | (?x) 1281 | {{fenced_code_block_start}} 1282 | ((?i:objc|obj-c|objectivec|objective-c)) 1283 | {{fenced_code_block_trailing_infostring_characters}} 1284 | captures: 1285 | 0: meta.code-fence.definition.begin.objc.markdown-gfm 1286 | 2: punctuation.definition.raw.code-fence.begin.markdown 1287 | 5: constant.other.language-name.markdown 1288 | embed: scope:source.objc 1289 | embed_scope: markup.raw.code-fence.objc.markdown-gfm 1290 | escape: '{{code_fence_escape}}' 1291 | escape_captures: 1292 | 0: meta.code-fence.definition.end.objc.markdown-gfm 1293 | 1: punctuation.definition.raw.code-fence.end.markdown 1294 | - match: |- 1295 | (?x) 1296 | {{fenced_code_block_start}} 1297 | ((?i:objc\+\+|obj-c\+\+|objectivec\+\+|objective-c\+\+)) 1298 | {{fenced_code_block_trailing_infostring_characters}} 1299 | captures: 1300 | 0: meta.code-fence.definition.begin.objc++.markdown-gfm 1301 | 2: punctuation.definition.raw.code-fence.begin.markdown 1302 | 5: constant.other.language-name.markdown 1303 | embed: scope:source.objc++ 1304 | embed_scope: markup.raw.code-fence.objc++.markdown-gfm 1305 | escape: '{{code_fence_escape}}' 1306 | escape_captures: 1307 | 0: meta.code-fence.definition.end.objc++.markdown-gfm 1308 | 1: punctuation.definition.raw.code-fence.end.markdown 1309 | - match: |- 1310 | (?x) 1311 | {{fenced_code_block_start}} 1312 | ((?i:c)) 1313 | {{fenced_code_block_trailing_infostring_characters}} 1314 | captures: 1315 | 0: meta.code-fence.definition.begin.c.markdown-gfm 1316 | 2: punctuation.definition.raw.code-fence.begin.markdown 1317 | 5: constant.other.language-name.markdown 1318 | embed: scope:source.c 1319 | embed_scope: markup.raw.code-fence.c.markdown-gfm 1320 | escape: '{{code_fence_escape}}' 1321 | escape_captures: 1322 | 0: meta.code-fence.definition.end.c.markdown-gfm 1323 | 1: punctuation.definition.raw.code-fence.end.markdown 1324 | - match: |- 1325 | (?x) 1326 | {{fenced_code_block_start}} 1327 | ((?i:c\+\+|cpp)) 1328 | {{fenced_code_block_trailing_infostring_characters}} 1329 | captures: 1330 | 0: meta.code-fence.definition.begin.c++.markdown-gfm 1331 | 2: punctuation.definition.raw.code-fence.begin.markdown 1332 | 5: constant.other.language-name.markdown 1333 | embed: scope:source.c++ 1334 | embed_scope: markup.raw.code-fence.c++.markdown-gfm 1335 | escape: '{{code_fence_escape}}' 1336 | escape_captures: 1337 | 0: meta.code-fence.definition.end.c++.markdown-gfm 1338 | 1: punctuation.definition.raw.code-fence.end.markdown 1339 | - match: |- 1340 | (?x) 1341 | {{fenced_code_block_start}} 1342 | ((?i:regexp|regex)) 1343 | {{fenced_code_block_trailing_infostring_characters}} 1344 | captures: 1345 | 0: meta.code-fence.definition.begin.regexp.markdown-gfm 1346 | 2: punctuation.definition.raw.code-fence.begin.markdown 1347 | 5: constant.other.language-name.markdown 1348 | embed: scope:source.regexp 1349 | embed_scope: markup.raw.code-fence.regexp.markdown-gfm 1350 | escape: '{{code_fence_escape}}' 1351 | escape_captures: 1352 | 0: meta.code-fence.definition.end.regexp.markdown-gfm 1353 | 1: punctuation.definition.raw.code-fence.end.markdown 1354 | - match: |- 1355 | (?x) 1356 | {{fenced_code_block_start}} 1357 | ([\w-]*) # any number of word characters or dashes 1358 | .*$\n? # all characters until EOL 1359 | captures: 1360 | 0: meta.code-fence.definition.begin.text.markdown-gfm 1361 | 2: punctuation.definition.raw.code-fence.begin.markdown 1362 | 5: constant.other.language-name.markdown 1363 | push: 1364 | - meta_content_scope: markup.raw.code-fence.markdown-gfm 1365 | - match: '{{code_fence_escape}}' 1366 | captures: 1367 | 0: meta.code-fence.definition.end.text.markdown-gfm 1368 | 1: punctuation.definition.raw.code-fence.end.markdown 1369 | pop: true 1370 | code-span: 1371 | - match: (`+)(?!`) 1372 | scope: punctuation.definition.raw.begin.markdown 1373 | push: 1374 | - meta_scope: markup.raw.inline.markdown 1375 | - match: \1(?!`) 1376 | scope: punctuation.definition.raw.end.markdown 1377 | pop: true 1378 | - match: '`+' 1379 | - match: ^\s*$\n? 1380 | scope: invalid.illegal.non-terminated.raw.markdown 1381 | pop: true 1382 | raw: 1383 | - match: ^(?={{fenced_code_block_start}}) 1384 | push: 1385 | - match: $ 1386 | pop: true 1387 | - include: fenced-code-block-knitr 1388 | - include: fenced-code-block 1389 | - include: code-span-knitr 1390 | - include: code-span 1391 | thematic-break: 1392 | - match: '(?={{thematic_break}})' 1393 | push: 1394 | - meta_scope: meta.separator.thematic-break.markdown 1395 | - match: '[-_*]+' 1396 | scope: punctuation.definition.thematic-break.markdown 1397 | - match: '$\n?' 1398 | pop: true 1399 | disable-markdown: 1400 | - include: latex-math 1401 | - include: scope:text.html.basic 1402 | disable-markdown-pop-at-tag: 1403 | - match: () 1404 | captures: 1405 | 1: meta.tag.block.any.html punctuation.definition.tag.begin.html 1406 | 2: meta.tag.block.any.html entity.name.tag.block.any.html 1407 | 3: meta.tag.block.any.html punctuation.definition.tag.end.html 1408 | pop: true 1409 | - include: disable-markdown 1410 | disable-markdown-pop-after-tag: 1411 | - match: (?! 1424 | pop: true 1425 | - include: disable-markdown 1426 | disable-markdown-pop-after-html-doctype: 1427 | - match: (?!