fileTypes md mdown markdown markdn keyEquivalent ^~M name Markdown patterns include #frontMatter include #block repository block patterns include #separator include #heading include #blockquote include #lists include #raw_block include #fenced_code_block_css include #fenced_code_block_basic include #fenced_code_block_ini include #fenced_code_block_java include #fenced_code_block_lua include #fenced_code_block_makefile include #fenced_code_block_perl include #fenced_code_block_r include #fenced_code_block_ruby include #fenced_code_block_php include #fenced_code_block_sql include #fenced_code_block_vs_net include #fenced_code_block_xml include #fenced_code_block_xsl include #fenced_code_block_yaml include #fenced_code_block_dosbatch include #fenced_code_block_clojure include #fenced_code_block_coffee include #fenced_code_block_c include #fenced_code_block_diff include #fenced_code_block_dockerfile include #fenced_code_block_git_commit include #fenced_code_block_git_rebase include #fenced_code_block_groovy include #fenced_code_block_jade include #fenced_code_block_js include #fenced_code_block_js_regexp include #fenced_code_block_json include #fenced_code_block_less include #fenced_code_block_objc include #fenced_code_block_perl6 include #fenced_code_block_powershell include #fenced_code_block_python include #fenced_code_block_regexp_python include #fenced_code_block_shell include #fenced_code_block_ts include #fenced_code_block_tsx include #fenced_code_block_csharp include #link-def include #html include #paragraph repository blockquote begin (^|\G)[ ]{0,3}(>) ? captures 2 name beginning.punctuation.definition.quote.markdown name markup.quote.markdown patterns include #block while (^|\G)\s*(>) ? heading begin (?:^|\G)(#{1,6})\s*(?=[\S[^#]]) captures 1 name punctuation.definition.heading.markdown contentName entity.name.section.markdown end \s*(#{1,6})?$\n? name markup.heading.${1/(#)(#)?(#)?(#)?(#)?(#)?/${6:?6:${5:?5:${4:?4:${3:?3:${2:?2:1}}}}}/}.markdown patterns include #inline heading-setext patterns match ^(={3,})(?=[ \t]*$\n?) name markup.heading.setext.1.markdown match ^(-{3,})(?=[ \t]*$\n?) name markup.heading.setext.2.markdown html patterns begin (^|\G)\s*(<!--) end (-->) contentName block.comment.html captures 1 name punctuation.definition.comment.html 2 name punctuation.definition.comment.html begin (^|\G)\s*(?=</?(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|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|pre|p|param|script|section|source|style|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(\s|$|/?>)) patterns include text.html.basic while ^(?!\s*$) begin (^|\G)\s*(?=(<[a-zA-Z0-9\-].*>|</[a-zA-Z0-9\-]>)\s*$) patterns include text.html.basic while ^(?!\s*$) link-def captures 1 name punctuation.definition.constant.markdown 10 name punctuation.definition.string.end.markdown 11 name string.other.link.description.title.markdown 12 name punctuation.definition.string.begin.markdown 13 name punctuation.definition.string.end.markdown 2 name constant.other.reference.link.markdown 3 name punctuation.definition.constant.markdown 4 name punctuation.separator.key-value.markdown 5 name punctuation.definition.link.markdown 6 name markup.underline.link.markdown 7 name punctuation.definition.link.markdown 8 name string.other.link.description.title.markdown 9 name punctuation.definition.string.begin.markdown match ^(?x: \s* # Leading whitespace (\[)(.+?)(\])(:) # Reference name [ \t]* # Optional whitespace (<?)(\S+?)(>?) # The url [ \t]* # Optional whitespace (?: ((\().+?(\))) # Match title in quotes… | ((").+?(")) # or in parens. )? # Title is optional \s* # Optional whitespace $ ) name meta.link.reference.def.markdown list_paragraph begin (^|\G)(?=\S)(?![*+-]\s|[0-9]+\.\s) name meta.paragraph.markdown patterns include #inline include text.html.basic include #heading-setext while (^|\G)(?!\s*$|#|[ ]{0,3}([-*_][ ]{2,}){3,}[ \t]*$\n?|>|[ ]{0,3}[*+-]|[ ]{0,3}[0-9]+\.) lists patterns begin (^|\G)([ ]{0,3})([*+-])([ ]{1,3}|\t) beginCaptures 3 name beginning.punctuation.definition.list.markdown comment Currently does not support un-indented second lines. name markup.list.unnumbered.markdown patterns include #list_paragraph include #block while (^|\G)([ ]{4}|\t) begin (^|\G)([ ]{0,3})([0-9]+\.)([ ]{1,3}|\t) beginCaptures 3 name beginning.punctuation.definition.list.markdown name markup.list.numbered.markdown patterns include #list_paragraph include #block while (^|\G)([ ]{4}|\t) paragraph begin (^|\G)[ ]{0,3}(?=\S) name meta.paragraph.markdown patterns include #inline include text.html.basic include #heading-setext while (^|\G)(?!\s*$|#|[ ]{0,3}((([*_][ ]{0,2}\2){2,}[ \t]*$\n?)|([*+-]([ ]{1,3}|\t)))|\s*\[.+?\]:|>) raw_block begin (^|\G)([ ]{4}|\t) name markup.raw.block.markdown while (^|\G)([ ]{4}|\t) fenced_code_block_css begin (^|\G)\s*(([`~]){3,})\s*(css|css.erb)(\s+.*)?$ name markup.fenced_code.block.markdown while (^|\G)(?!\s*\2\3*\s*$) patterns include source.css fenced_code_block_basic begin (^|\G)\s*(([`~]){3,})\s*(html|htm|shtml|xhtml|inc|tmpl|tpl)(\s+.*)?$ name markup.fenced_code.block.markdown while (^|\G)(?!\s*\2\3*\s*$) patterns include text.html.basic fenced_code_block_ini begin (^|\G)\s*(([`~]){3,})\s*(ini|conf)(\s+.*)?$ name markup.fenced_code.block.markdown while (^|\G)(?!\s*\2\3*\s*$) patterns include source.ini fenced_code_block_java begin (^|\G)\s*(([`~]){3,})\s*(java|bsh)(\s+.*)?$ name markup.fenced_code.block.markdown while (^|\G)(?!\s*\2\3*\s*$) patterns include source.java fenced_code_block_lua begin (^|\G)\s*(([`~]){3,})\s*(lua)(\s+.*)?$ name markup.fenced_code.block.markdown while (^|\G)(?!\s*\2\3*\s*$) patterns include source.lua fenced_code_block_makefile begin (^|\G)\s*(([`~]){3,})\s*(Makefile|makefile|GNUmakefile|OCamlMakefile)(\s+.*)?$ name markup.fenced_code.block.markdown while (^|\G)(?!\s*\2\3*\s*$) patterns include source.makefile fenced_code_block_perl begin (^|\G)\s*(([`~]){3,})\s*(perl|pl|pm|pod|t|PL|psgi|vcl)(\s+.*)?$ name markup.fenced_code.block.markdown while (^|\G)(?!\s*\2\3*\s*$) patterns include source.perl fenced_code_block_r begin (^|\G)\s*(([`~]){3,})\s*(R|r|s|S|Rprofile)(\s+.*)?$ name markup.fenced_code.block.markdown while (^|\G)(?!\s*\2\3*\s*$) patterns include source.r fenced_code_block_ruby begin (^|\G)\s*(([`~]){3,})\s*(ruby|rb|rbx|rjs|Rakefile|rake|cgi|fcgi|gemspec|irbrc|Capfile|ru|prawn|Cheffile|Gemfile|Guardfile|Hobofile|Vagrantfile|Appraisals|Rantfile|Berksfile|Berksfile.lock|Thorfile|Puppetfile)(\s+.*)?$ name markup.fenced_code.block.markdown while (^|\G)(?!\s*\2\3*\s*$) patterns include source.ruby fenced_code_block_php comment In fenced PHP code blocks, we match a "fuzzy" version of the PHP language. This is because code blocks may be an incomplete PHP script that lacks a script section start tag, and we still want to provide syntax highlighting, rather than adhering to the actual grammar, where everything not prepended by a start tag would be ignored. Additionally, we want to provide highlighting for potential non-PHP languages (in particular HTML). There are certainly plenty of edge cases here, but this seems to cover most popular scenarios, and also appears to be consistent with the approach that GitHub takes. begin (^|\G)\s*(([`~]){3,})\s*(php|php3|php4|php5|phpt|phtml|aw|ctp)(\s+.*)?$ name markup.fenced_code.block.markdown while (^|\G)(?!\s*\2\3*\s*$) patterns comment Left to its own devices, the PHP grammar will match HTML as a combination of operators and constants. Therefore, HTML must take precedence over PHP in order to get proper syntax highlighting. include text.html.basic include text.html.php#language fenced_code_block_sql begin (^|\G)\s*(([`~]){3,})\s*(sql|ddl|dml)(\s+.*)?$ name markup.fenced_code.block.markdown while (^|\G)(?!\s*\2\3*\s*$) patterns include source.sql fenced_code_block_vs_net begin (^|\G)\s*(([`~]){3,})\s*(vb)(\s+.*)?$ name markup.fenced_code.block.markdown while (^|\G)(?!\s*\2\3*\s*$) patterns include source.asp.vb.net fenced_code_block_xml begin (^|\G)\s*(([`~]){3,})\s*(xml|xsd|tld|jsp|pt|cpt|dtml|rss|opml)(\s+.*)?$ name markup.fenced_code.block.markdown while (^|\G)(?!\s*\2\3*\s*$) patterns include text.xml fenced_code_block_xsl begin (^|\G)\s*(([`~]){3,})\s*(xsl|xslt)(\s+.*)?$ name markup.fenced_code.block.markdown while (^|\G)(?!\s*\2\3*\s*$) patterns include text.xml.xsl fenced_code_block_yaml begin (^|\G)\s*(([`~]){3,})\s*(yaml|yml)(\s+.*)?$ name markup.fenced_code.block.markdown while (^|\G)(?!\s*\2\3*\s*$) patterns include source.yaml fenced_code_block_dosbatch begin (^|\G)\s*(([`~]){3,})\s*(bat|batch)(\s+.*)?$ name markup.fenced_code.block.markdown while (^|\G)(?!\s*\2\3*\s*$) patterns include source.dosbatch fenced_code_block_clojure begin (^|\G)\s*(([`~]){3,})\s*(clj|cljs|clojure)(\s+.*)?$ name markup.fenced_code.block.markdown while (^|\G)(?!\s*\2\3*\s*$) patterns include source.clojure fenced_code_block_coffee begin (^|\G)\s*(([`~]){3,})\s*(coffee|Cakefile|coffee.erb)(\s+.*)?$ name markup.fenced_code.block.markdown while (^|\G)(?!\s*\2\3*\s*$) patterns include source.coffee fenced_code_block_c begin (^|\G)\s*(([`~]){3,})\s*(c|h)(\s+.*)?$ name markup.fenced_code.block.markdown while (^|\G)(?!\s*\2\3*\s*$) patterns include source.c fenced_code_block_diff begin (^|\G)\s*(([`~]){3,})\s*(patch|diff|rej)(\s+.*)?$ name markup.fenced_code.block.markdown while (^|\G)(?!\s*\2\3*\s*$) patterns include source.diff fenced_code_block_dockerfile begin (^|\G)\s*(([`~]){3,})\s*(dockerfile|Dockerfile)(\s+.*)?$ name markup.fenced_code.block.markdown while (^|\G)(?!\s*\2\3*\s*$) patterns include source.dockerfile fenced_code_block_git_commit begin (^|\G)\s*(([`~]){3,})\s*(COMMIT_EDITMSG|MERGE_MSG)(\s+.*)?$ name markup.fenced_code.block.markdown while (^|\G)(?!\s*\2\3*\s*$) patterns include text.git-commit fenced_code_block_git_rebase begin (^|\G)\s*(([`~]){3,})\s*(git-rebase-todo)(\s+.*)?$ name markup.fenced_code.block.markdown while (^|\G)(?!\s*\2\3*\s*$) patterns include text.git-rebase fenced_code_block_groovy begin (^|\G)\s*(([`~]){3,})\s*(groovy|gvy)(\s+.*)?$ name markup.fenced_code.block.markdown while (^|\G)(?!\s*\2\3*\s*$) patterns include source.groovy fenced_code_block_jade begin (^|\G)\s*(([`~]){3,})\s*(jade)(\s+.*)?$ name markup.fenced_code.block.markdown while (^|\G)(?!\s*\2\3*\s*$) patterns include text.jade fenced_code_block_js begin (^|\G)\s*(([`~]){3,})\s*(js|jsx|javascript)(\s+.*)?$ name markup.fenced_code.block.markdown while (^|\G)(?!\s*\2\3*\s*$) patterns include source.js fenced_code_block_js_regexp begin (^|\G)\s*(([`~]){3,})\s*(regexp)(\s+.*)?$ name markup.fenced_code.block.markdown while (^|\G)(?!\s*\2\3*\s*$) patterns include source.js.regexp fenced_code_block_json begin (^|\G)\s*(([`~]){3,})\s*(json|sublime-settings|sublime-menu|sublime-keymap|sublime-mousemap|sublime-theme|sublime-build|sublime-project|sublime-completions)(\s+.*)?$ name markup.fenced_code.block.markdown while (^|\G)(?!\s*\2\3*\s*$) patterns include source.json fenced_code_block_less begin (^|\G)\s*(([`~]){3,})\s*(less)(\s+.*)?$ name markup.fenced_code.block.markdown while (^|\G)(?!\s*\2\3*\s*$) patterns include source.css.less fenced_code_block_objc begin (^|\G)\s*(([`~]){3,})\s*(objectivec|mm|objc|obj-c|m|h)(\s+.*)?$ name markup.fenced_code.block.markdown while (^|\G)(?!\s*\2\3*\s*$) patterns include source.objc fenced_code_block_perl6 begin (^|\G)\s*(([`~]){3,})\s*(perl6|p6|pl6|pm6|nqp)(\s+.*)?$ name markup.fenced_code.block.markdown while (^|\G)(?!\s*\2\3*\s*$) patterns include source.perl.6 fenced_code_block_powershell begin (^|\G)\s*(([`~]){3,})\s*(powershell|ps1|psm1|psd1)(\s+.*)?$ name markup.fenced_code.block.markdown while (^|\G)(?!\s*\2\3*\s*$) patterns include source.powershell fenced_code_block_python begin (^|\G)\s*(([`~]){3,})\s*(python|py|py3|rpy|pyw|cpy|SConstruct|Sconstruct|sconstruct|SConscript|gyp|gypi)(\s+.*)?$ name markup.fenced_code.block.markdown while (^|\G)(?!\s*\2\3*\s*$) patterns include source.python fenced_code_block_regexp_python begin (^|\G)\s*(([`~]){3,})\s*(re)(\s+.*)?$ name markup.fenced_code.block.markdown while (^|\G)(?!\s*\2\3*\s*$) patterns include source.regexp.python fenced_code_block_shell begin (^|\G)\s*(([`~]){3,})\s*(shell|sh|bash|zsh|bashrc|bash_profile|bash_login|profile|bash_logout|.textmate_init)(\s+.*)?$ name markup.fenced_code.block.markdown while (^|\G)(?!\s*\2\3*\s*$) patterns include source.shell fenced_code_block_ts begin (^|\G)\s*(([`~]){3,})\s*(typescript|ts)(\s+.*)?$ name markup.fenced_code.block.markdown while (^|\G)(?!\s*\2\3*\s*$) patterns include source.ts fenced_code_block_tsx begin (^|\G)\s*(([`~]){3,})\s*(tsx)(\s+.*)?$ name markup.fenced_code.block.markdown while (^|\G)(?!\s*\2\3*\s*$) patterns include source.tsx fenced_code_block_csharp begin (^|\G)\s*(([`~]){3,})\s*(cs|csharp|c#)(\s+.*)?$ name markup.fenced_code.block.markdown while (^|\G)(?!\s*\2\3*\s*$) patterns include source.cs separator match (^|\G)[ ]{0,3}([*-_])([ ]{0,2}\2){2,}[ \t]*$\n? name meta.separator.markdown inline patterns include #ampersand include #bracket include #bold include #italic include #raw include #escape include #image-inline include #image-ref include #link-email include #link-inet include #link-inline include #link-ref include #link-ref-literal repository ampersand comment Markdown will convert this for us. We match it so that the HTML grammar will not mark it up as invalid. match &(?!([a-zA-Z0-9]+|#[0-9]+|#x[0-9a-fA-F]+);) name meta.other.valid-ampersand.markdown bold begin (?x) (\*\*|__)(?=\S) # Open (?= ( <[^>]*+> # HTML tags | (?<raw>`+)([^`]|(?!(?<!`)\k<raw>(?!`))`)*+\k<raw> # Raw | \\[\\`*_{}\[\]()#.!+\->]?+ # Escapes | \[ ( (?<square> # Named group [^\[\]\\] # Match most chars | \\. # Escaped chars | \[ \g<square>*+ \] # Nested brackets )*+ \] ( ( # Reference Link [ ]? # Optional space \[[^\]]*+\] # Ref name ) | ( # Inline Link \( # Opening paren [ \t]*+ # Optional whtiespace <?(.*?)>? # URL [ \t]*+ # Optional whtiespace ( # Optional Title (?<title>['"]) (.*?) \k<title> )? \) ) ) ) | (?!(?<=\S)\1). # Everything besides # style closer )++ (?<=\S)\1 # Close ) captures 1 name punctuation.definition.bold.markdown end (?<=\S)(\1) name markup.bold.markdown patterns applyEndPatternLast 1 begin (?=<[^>]*?>) end (?<=>) patterns include text.html.basic include #escape include #ampersand include #bracket include #raw include #italic include #image-inline include #link-inline include #link-inet include #link-email include #image-ref include #link-ref-literal include #link-ref bracket comment Markdown will convert this for us. We match it so that the HTML grammar will not mark it up as invalid. match <(?![a-z/?\$!]) name meta.other.valid-bracket.markdown escape match \\[-`*_#+.!(){}\[\]\\>] name constant.character.escape.markdown image-inline captures 1 name punctuation.definition.string.begin.markdown 10 name string.other.link.description.title.markdown 11 name punctuation.definition.string.markdown 12 name punctuation.definition.string.markdown 13 name string.other.link.description.title.markdown 14 name punctuation.definition.string.markdown 15 name punctuation.definition.string.markdown 16 name punctuation.definition.metadata.markdown 2 name string.other.link.description.markdown 4 name punctuation.definition.string.end.markdown 5 name invalid.illegal.whitespace.markdown 6 name punctuation.definition.metadata.markdown 7 name punctuation.definition.link.markdown 8 name markup.underline.link.image.markdown 9 name punctuation.definition.link.markdown match (?x: (\!\[)((?<square>[^\[\]\\]|\\.|\[\g<square>*+\])*+)(\]) # Match the link text. ([ ])? # Space not allowed (\() # Opening paren for url (<?)(\S+?)(>?) # The url [ \t]* # Optional whitespace (?: ((\().+?(\))) # Match title in parens… | ((").+?(")) # or in quotes. )? # Title is optional \s* # Optional whitespace (\)) ) name meta.image.inline.markdown image-ref captures 1 name punctuation.definition.string.begin.markdown 2 name string.other.link.description.markdown 4 name punctuation.definition.string.begin.markdown 5 name punctuation.definition.constant.markdown 6 name constant.other.reference.link.markdown 7 name punctuation.definition.constant.markdown match (\!\[)((?<square>[^\[\]\\]|\\.|\[\g<square>*+\])*+)(\])[ ]?(\[)(.*?)(\]) name meta.image.reference.markdown italic begin (?x) (\*|_)(?=\S) # Open (?= ( <[^>]*+> # HTML tags | (?<raw>`+)([^`]|(?!(?<!`)\k<raw>(?!`))`)*+\k<raw> # Raw | \\[\\`*_{}\[\]()#.!+\->]?+ # Escapes | \[ ( (?<square> # Named group [^\[\]\\] # Match most chars | \\. # Escaped chars | \[ \g<square>*+ \] # Nested brackets )*+ \] ( ( # Reference Link [ ]? # Optional space \[[^\]]*+\] # Ref name ) | ( # Inline Link \( # Opening paren [ \t]*+ # Optional whtiespace <?(.*?)>? # URL [ \t]*+ # Optional whtiespace ( # Optional Title (?<title>['"]) (.*?) \k<title> )? \) ) ) ) | \1\1 # Must be bold closer | (?!(?<=\S)\1). # Everything besides # style closer )++ (?<=\S)\1 # Close ) captures 1 name punctuation.definition.italic.markdown end (?<=\S)(\1)((?!\1)|(?=\1\1)) name markup.italic.markdown patterns applyEndPatternLast 1 begin (?=<[^>]*?>) end (?<=>) patterns include text.html.basic include #escape include #ampersand include #bracket include #raw include #bold include #image-inline include #link-inline include #link-inet include #link-email include #image-ref include #link-ref-literal include #link-ref link-email captures 1 name punctuation.definition.link.markdown 2 name markup.underline.link.markdown 4 name punctuation.definition.link.markdown match (<)((?:mailto:)?[-.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(>) name meta.link.email.lt-gt.markdown link-inet captures 1 name punctuation.definition.link.markdown 2 name markup.underline.link.markdown 3 name punctuation.definition.link.markdown match (<)((?:https?|ftp)://.*?)(>) name meta.link.inet.markdown link-inline captures 1 name punctuation.definition.string.begin.markdown 10 name string.other.link.description.title.markdown 11 name punctuation.definition.string.begin.markdown 12 name punctuation.definition.string.end.markdown 13 name string.other.link.description.title.markdown 14 name punctuation.definition.string.begin.markdown 15 name punctuation.definition.string.end.markdown 16 name punctuation.definition.metadata.markdown 2 name string.other.link.title.markdown 4 name punctuation.definition.string.end.markdown 5 name invalid.illegal.whitespace.markdown 6 name punctuation.definition.metadata.markdown 7 name punctuation.definition.link.markdown 8 name markup.underline.link.markdown 9 name punctuation.definition.link.markdown match (?x: (\[)((?<square>[^\[\]\\]|\\.|\[\g<square>*+\])*+)(\]) # Match the link text. ([ ])? # Space not allowed (\() # Opening paren for url (<?)(.*?)(>?) # The url [ \t]* # Optional whitespace (?: ((\().+?(\))) # Match title in parens… | ((").+?(")) # or in quotes. )? # Title is optional \s* # Optional whitespace (\)) ) name meta.link.inline.markdown link-ref captures 1 name punctuation.definition.string.begin.markdown 2 name string.other.link.title.markdown 4 name punctuation.definition.string.end.markdown 5 name punctuation.definition.constant.begin.markdown 6 name constant.other.reference.link.markdown 7 name punctuation.definition.constant.end.markdown match (\[)((?<square>[^\[\]\\]|\\.|\[\g<square>*+\])*+)(\])[ ]?(\[)([^\]]*+)(\]) name meta.link.reference.markdown link-ref-literal captures 1 name punctuation.definition.string.begin.markdown 2 name string.other.link.title.markdown 4 name punctuation.definition.string.end.markdown 5 name punctuation.definition.constant.begin.markdown 6 name punctuation.definition.constant.end.markdown match (\[)((?<square>[^\[\]\\]|\\.|\[\g<square>*+\])*+)(\])[ ]?(\[)(\]) name meta.link.reference.literal.markdown raw captures 1 name punctuation.definition.raw.markdown 3 name punctuation.definition.raw.markdown match (`+)([^`]|(?!(?<!`)\1(?!`))`)*+(\1) name markup.raw.inline.markdown frontMatter begin \A-{3}\s*$ while ^(?!-{3}\s*$) patterns include source.yaml scopeName text.html.markdown uuid 0A1D9874-B448-11D9-BD50-000D93B6E43C