From b31d078bb5130a88356192008d3b4504a0958775 Mon Sep 17 00:00:00 2001 From: deathaxe Date: Sat, 7 May 2022 11:48:42 +0200 Subject: [PATCH] [Markdown] Refactor Syntax (#3167) [Markdown] Refactor Syntax Fixes #1930 Fixes #2542 Fixes #2857 Fixes #2942 Fixes #3073 Addresses #3154 (in ST3 compatible way) Fixes #3157 Fixes #3170 Addresses #3228 This commit refactors Markdown syntax to 1. improve compliance with CommonMark specification: https://spec.commonmark.org/0.30 Many tests are added to proof compliance: https://spec.commonmark.org/0.30/spec.json Latest GFM syntax is based on CommonMark at the time writing, so those rules are included as well: https://github.github.com/gfm/ 2. convert most anonymous to named contexts for better support of inheritance. 3. reorganize syntax into logical sections for better readability and maintainability. 4. address most Markdown related issues of sublimehq/Packages repo. Main changes are: - fix CommonMark compatibility of backslash escapes - fix CommonMark compatibility of block quotes - fix CommonMark compatibility of html entities - fix CommonMark compatibility of fenced code blocks - fix CommonMark compatibility of indented code blocks (mixed tabs/spaces) - fix CommonMark compatibility of reference definitions - fix CommonMark compatibility of thematic breaks - update strike-through markup to use 2 tildes only - reorganizing contexts in logical sections Benchmarks: This commit has no impact on parsing performance. Notes: 1. Some remaining CommonMark incompatibilities need further work using ST4's "branching" feature. 2. Main refactoring work was done in MarkdownEditing package and released with version 3.1.1. This commit contains the result of that work, except some features which rely on 3rd-party (syntax) packages. Removed features are: - coffee script support in front-matter - numerous code-block syntaxes (E.g.: Ada, Coffee Script, ...) - LaTex blocks - custom `` tag highlighting as it doesn't meet quality expectations --- .../Code Block Syntaxes.sublime-completions | 370 +- Markdown/Markdown.sublime-syntax | 3141 ++++--- Markdown/MultiMarkdown.sublime-syntax | 46 +- Markdown/Shell (for Markdown).sublime-syntax | 29 + Markdown/syntax_test_markdown.md | 3104 ------- Markdown/tests/syntax_test_markdown.md | 7869 +++++++++++++++++ .../{ => tests}/syntax_test_multimarkdown.md | 4 +- 7 files changed, 10095 insertions(+), 4468 deletions(-) create mode 100644 Markdown/Shell (for Markdown).sublime-syntax delete mode 100644 Markdown/syntax_test_markdown.md create mode 100644 Markdown/tests/syntax_test_markdown.md rename Markdown/{ => tests}/syntax_test_multimarkdown.md (95%) diff --git a/Markdown/Code Block Syntaxes.sublime-completions b/Markdown/Code Block Syntaxes.sublime-completions index e5a573d532..8eaabb23c3 100644 --- a/Markdown/Code Block Syntaxes.sublime-completions +++ b/Markdown/Code Block Syntaxes.sublime-completions @@ -1,23 +1,53 @@ { "scope": "text.html.markdown meta.code-fence.definition.begin", "completions": [ + + // ActionScript { - "trigger": "bash", - "annotation": "Bourne Against Shell", + "trigger": "actionscript", + "annotation": "ActionScript", "kind": ["markup", "s", "Syntax"], - "details": "Specifies ShellScript code highlighting" + "details": "Specifies ActionScript code highlighting" + }, + { + "trigger": "as", + "annotation": "ActionScript", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies ActionScript code highlighting" + }, + + // AppleScript + { + "trigger": "AppleScript", + "annotation": "AppleScript", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies AppleScript code highlighting" + }, + { + "trigger": "osascript", + "annotation": "AppleScript", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies AppleScript code highlighting" }, + + // C++ { "trigger": "c", - "annotation": "C", + "annotation": "C source", "kind": ["markup", "s", "Syntax"], "details": "Specifies C code highlighting" }, { - "trigger": "c#", - "annotation": "C#", + "trigger": "cpp", + "annotation": "C++", "kind": ["markup", "s", "Syntax"], - "details": "Specifies C# code highlighting" + "details": "Specifies C++ code highlighting" + }, + { + "trigger": "cxx", + "annotation": "C++", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies C++ code highlighting" }, { "trigger": "c++", @@ -26,23 +56,37 @@ "details": "Specifies C++ code highlighting" }, { - "trigger": "clj", - "annotation": "Clojure", + "trigger": "h", + "annotation": "C header", "kind": ["markup", "s", "Syntax"], - "details": "Specifies Clojure code highlighting" + "details": "Specifies C code highlighting" }, { - "trigger": "clojure", - "annotation": "Clojure", + "trigger": "hpp", + "annotation": "C++ header", "kind": ["markup", "s", "Syntax"], - "details": "Specifies Clojure code highlighting" + "details": "Specifies C++ code highlighting" }, { - "trigger": "cpp", - "annotation": "C++", + "trigger": "hxx", + "annotation": "C++ header", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies C++ code highlighting" + }, + { + "trigger": "h++", + "annotation": "C++ header", "kind": ["markup", "s", "Syntax"], "details": "Specifies C++ code highlighting" }, + + // C# + { + "trigger": "csharp", + "annotation": "C#", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies C# code highlighting" + }, { "trigger": "cs", "annotation": "C#", @@ -50,17 +94,69 @@ "details": "Specifies C# code highlighting" }, { - "trigger": "csharp", + "trigger": "c#", "annotation": "C#", "kind": ["markup", "s", "Syntax"], "details": "Specifies C# code highlighting" }, + + // Clojure + { + "trigger": "clojure", + "annotation": "Clojure", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies Clojure code highlighting" + }, + { + "trigger": "clj", + "annotation": "Clojure", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies Clojure code highlighting" + }, + + // CSS + { + "trigger": "css", + "annotation": "Stylesheet", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies CSS code highlighting" + }, + + // Diff { "trigger": "diff", "annotation": "Diff", "kind": ["markup", "s", "Syntax"], "details": "Specifies Diff code highlighting" }, + { + "trigger": "patch", + "annotation": "Patch", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies Patch code highlighting" + }, + + // Dosbatch + { + "trigger": "bat", + "annotation": "DOS batch", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies DOS batch code highlighting" + }, + { + "trigger": "cmd", + "annotation": "DOS batch", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies DOS batch code highlighting" + }, + { + "trigger": "dos", + "annotation": "DOS batch", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies DOS batch code highlighting" + }, + + // Erlang { "trigger": "erlang", "annotation": "Erlang", @@ -73,6 +169,8 @@ "kind": ["markup", "s", "Syntax"], "details": "Specifies Erlang code highlighting" }, + + // Go { "trigger": "go", "annotation": "Go", @@ -85,42 +183,52 @@ "kind": ["markup", "s", "Syntax"], "details": "Specifies Go code highlighting" }, + + // GraphViz { "trigger": "graphviz", "annotation": "GraphViz", "kind": ["markup", "s", "Syntax"], "details": "Specifies GraphViz code highlighting" }, + + // Haskell { "trigger": "haskell", "annotation": "Haskell", "kind": ["markup", "s", "Syntax"], "details": "Specifies Haskell code highlighting" }, + + // HTML { "trigger": "html", "annotation": "HTML", "kind": ["markup", "s", "Syntax"], "details": "Specifies HTML code highlighting" }, + + // Java { - "trigger": "html+php", - "annotation": "PHP", + "trigger": "java", + "annotation": "Java", "kind": ["markup", "s", "Syntax"], - "details": "Specifies HTML+PHP code highlighting" + "details": "Specifies Java code highlighting" }, { - "trigger": "inc", - "annotation": "PHP", + "trigger": "jsp", + "annotation": "Java Server Pages", "kind": ["markup", "s", "Syntax"], - "details": "Specifies PHP code highlighting" + "details": "Specifies Java Server Pages code highlighting" }, { - "trigger": "java", - "annotation": "Java", + "trigger": "jspx", + "annotation": "Java Server Pages", "kind": ["markup", "s", "Syntax"], - "details": "Specifies Java code highlighting" + "details": "Specifies Java Server Pages code highlighting" }, + + // JavaScript { "trigger": "javascript", "annotation": "JavaScript", @@ -134,143 +242,189 @@ "details": "Specifies JavaScript code highlighting" }, { - "trigger": "json", - "annotation": "JSON", + "trigger": "JSX", + "annotation": "JavaScript React", "kind": ["markup", "s", "Syntax"], - "details": "Specifies JSON code highlighting" + "details": "Specifies JavaScript React code highlighting" }, { - "trigger": "jsonc", - "annotation": "JSON with Comments", + "trigger": "ts", + "annotation": "TypeScript", "kind": ["markup", "s", "Syntax"], - "details": "Specifies JSON with Comments code highlighting" + "details": "Specifies TypeScript code highlighting" }, { - "trigger": "jsp", - "annotation": "Java Server Pages", + "trigger": "tsx", + "annotation": "TypeScript React", "kind": ["markup", "s", "Syntax"], - "details": "Specifies Java Server Pages code highlighting" + "details": "Specifies TypeScript React code highlighting" }, { - "trigger": "jspx", - "annotation": "Java Server Pages", + "trigger": "typescript", + "annotation": "TypeScript", "kind": ["markup", "s", "Syntax"], - "details": "Specifies Java Server Pages code highlighting" + "details": "Specifies TypeScript code highlighting" }, + + // JSON { - "trigger": "JSX", - "annotation": "JavaScript React", + "trigger": "json", + "annotation": "JSON", "kind": ["markup", "s", "Syntax"], - "details": "Specifies JavaScript React code highlighting" + "details": "Specifies JSON code highlighting" }, + { + "trigger": "jsonc", + "annotation": "JSON with Comments", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies JSON with Comments code highlighting" + }, + + // Lisp { "trigger": "lisp", "annotation": "Lisp", "kind": ["markup", "s", "Syntax"], "details": "Specifies Lisp code highlighting" }, + + // Lua { "trigger": "lua", "annotation": "Lua", "kind": ["markup", "s", "Syntax"], "details": "Specifies Lua code highlighting" }, + + // Matlab { "trigger": "matlab", "annotation": "MatLab", "kind": ["markup", "s", "Syntax"], "details": "Specifies MatLab code highlighting" }, + + // Objective C++ { - "trigger": "obj-c", + "trigger": "objc", "annotation": "Objective-C", "kind": ["markup", "s", "Syntax"], "details": "Specifies Objective-C code highlighting" }, { - "trigger": "obj-c++", - "annotation": "Objective-C++", + "trigger": "objectivec", + "annotation": "Objective-C", "kind": ["markup", "s", "Syntax"], - "details": "Specifies Objective-C++ code highlighting" + "details": "Specifies Objective-C code highlighting" }, { - "trigger": "objc", + "trigger": "obj-c", "annotation": "Objective-C", "kind": ["markup", "s", "Syntax"], "details": "Specifies Objective-C code highlighting" }, { - "trigger": "objc++", - "annotation": "Objective-C++", + "trigger": "objective-c", + "annotation": "Objective-C", "kind": ["markup", "s", "Syntax"], - "details": "Specifies Objective-C++ code highlighting" + "details": "Specifies Objective-C code highlighting" }, { - "trigger": "objective-c", - "annotation": "Objective-C", + "trigger": "objc++", + "annotation": "Objective-C++", "kind": ["markup", "s", "Syntax"], - "details": "Specifies code highlighting" + "details": "Specifies Objective-C++ code highlighting" }, { - "trigger": "objective-c++", + "trigger": "objectivec++", "annotation": "Objective-C++", "kind": ["markup", "s", "Syntax"], "details": "Specifies Objective-C++ code highlighting" }, { - "trigger": "objectivec", - "annotation": "Objective-C", + "trigger": "obj-c++", + "annotation": "Objective-C++", "kind": ["markup", "s", "Syntax"], "details": "Specifies Objective-C++ code highlighting" }, { - "trigger": "objectivec++", + "trigger": "objective-c++", "annotation": "Objective-C++", "kind": ["markup", "s", "Syntax"], "details": "Specifies Objective-C++ code highlighting" }, + + // OCaml { "trigger": "ocaml", "annotation": "OCaml", "kind": ["markup", "s", "Syntax"], "details": "Specifies OCaml code highlighting" }, - { - "trigger": "patch", - "annotation": "Patch", - "kind": ["markup", "s", "Syntax"], - "details": "Specifies Patch code highlighting" - }, + + // Perl { "trigger": "perl", "annotation": "Perl 5", "kind": ["markup", "s", "Syntax"], "details": "Specifies Perl 5 code highlighting" }, + + // PHP + { + "trigger": "html+php", + "annotation": "PHP", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies HTML+PHP code highlighting" + }, + { + "trigger": "inc", + "annotation": "PHP", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies PHP code highlighting" + }, { "trigger": "php", "annotation": "PHP", "kind": ["markup", "s", "Syntax"], "details": "Specifies PHP code highlighting" }, + + // Phyton { - "trigger": "py", + "trigger": "python", "annotation": "Python", "kind": ["markup", "s", "Syntax"], "details": "Specifies Python code highlighting" }, { - "trigger": "python", + "trigger": "py", "annotation": "Python", "kind": ["markup", "s", "Syntax"], "details": "Specifies Python code highlighting" }, + + // R { "trigger": "r", "annotation": "R", "kind": ["markup", "s", "Syntax"], "details": "Specifies R code highlighting" }, + { + "trigger": "splus", + "annotation": "R", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies R code highlighting" + }, + + // Ruby + { + "trigger": "ruby", + "annotation": "Ruby", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies Ruby code highlighting" + }, { "trigger": "rb", "annotation": "Ruby", @@ -283,6 +437,8 @@ "kind": ["markup", "s", "Syntax"], "details": "Specifies Ruby on Rails code highlighting" }, + + // Regular Expressions { "trigger": "regex", "annotation": "Regular Expressions", @@ -295,6 +451,14 @@ "kind": ["markup", "s", "Syntax"], "details": "Specifies Regular Expressions code highlighting" }, + + // Rust + { + "trigger": "rust", + "annotation": "Rust", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies Rust code highlighting" + }, { "trigger": "rs", "annotation": "Rust", @@ -307,26 +471,30 @@ "kind": ["markup", "s", "Syntax"], "details": "Specifies R Script code highlighting" }, + + // Scala { - "trigger": "ruby", - "annotation": "Ruby", + "trigger": "scala", + "annotation": "Scala", "kind": ["markup", "s", "Syntax"], - "details": "Specifies Ruby code highlighting" + "details": "Specifies Scala code highlighting" }, + + // ShellScript { - "trigger": "rust", - "annotation": "Rust", + "trigger": "bash", + "annotation": "Bourne Against Shell", "kind": ["markup", "s", "Syntax"], - "details": "Specifies Rust code highlighting" + "details": "Specifies ShellScript code highlighting" }, { - "trigger": "scala", - "annotation": "Scala", + "trigger": "console", + "annotation": "ShellScript", "kind": ["markup", "s", "Syntax"], - "details": "Specifies Scala code highlighting" + "details": "Specifies ShellScript code highlighting" }, { - "trigger": "sh", + "trigger": "shell-script", "annotation": "ShellScript", "kind": ["markup", "s", "Syntax"], "details": "Specifies ShellScript code highlighting" @@ -338,40 +506,50 @@ "details": "Specifies ShellScript code highlighting" }, { - "trigger": "shell-script", + "trigger": "sh", "annotation": "ShellScript", "kind": ["markup", "s", "Syntax"], "details": "Specifies ShellScript code highlighting" }, { - "trigger": "splus", - "annotation": "R", + "trigger": "zsh", + "annotation": "ShellScript", "kind": ["markup", "s", "Syntax"], - "details": "Specifies R code highlighting" + "details": "Specifies ShellScript code highlighting" }, + + // SQL { "trigger": "sql", "annotation": "SQL", "kind": ["markup", "s", "Syntax"], "details": "Specifies SQL code highlighting" }, + + // XML { - "trigger": "ts", - "annotation": "TypeScript", + "trigger": "atom", + "annotation": "ATOM", "kind": ["markup", "s", "Syntax"], - "details": "Specifies TypeScript code highlighting" + "details": "Specifies XML code highlighting" }, { - "trigger": "tsx", - "annotation": "TypeScript React", + "trigger": "plist", + "annotation": "PList", "kind": ["markup", "s", "Syntax"], - "details": "Specifies TypeScript React code highlighting" + "details": "Specifies XML code highlighting" }, { - "trigger": "typescript", - "annotation": "TypeScript", + "trigger": "svg", + "annotation": "SVG", "kind": ["markup", "s", "Syntax"], - "details": "Specifies TypeScript code highlighting" + "details": "Specifies XML code highlighting" + }, + { + "trigger": "xjb", + "annotation": "XJB", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies XML code highlighting" }, { "trigger": "xml", @@ -380,16 +558,24 @@ "details": "Specifies XML code highlighting" }, { - "trigger": "yaml", - "annotation": "YAML", + "trigger": "xsd", + "annotation": "XSD", "kind": ["markup", "s", "Syntax"], - "details": "Specifies YAML code highlighting" + "details": "Specifies XML code highlighting" }, { - "trigger": "zsh", - "annotation": "ShellScript", + "trigger": "xsl", + "annotation": "XSL", "kind": ["markup", "s", "Syntax"], - "details": "Specifies ShellScript code highlighting" + "details": "Specifies XML code highlighting" + }, + + // YAML + { + "trigger": "yaml", + "annotation": "YAML", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies YAML code highlighting" }, ], } \ No newline at end of file diff --git a/Markdown/Markdown.sublime-syntax b/Markdown/Markdown.sublime-syntax index c573f3cbe6..d07abcd8f7 100644 --- a/Markdown/Markdown.sublime-syntax +++ b/Markdown/Markdown.sublime-syntax @@ -1,15 +1,17 @@ %YAML 1.2 --- -# http://www.sublimetext.com/docs/3/syntax.html +# This definition aims to meet CommonMark specifications +# http://spec.commonmark.org/ +# with GitHub Formatted Markdown extensions +# https://github.github.com/gfm/ +# and has a few extras like Markdown Extra's footnotes +# https://michelf.ca/projects/php-markdown/extra/#footnotes +# +# The scope suffix should indicate which flavor of Markdown the feature came from, +# to help make this syntax definition easier to maintain. name: Markdown scope: text.html.markdown -comment: |- - this definition aims to meet CommonMark specifications http://spec.commonmark.org/ - with GitHub Formatted Markdown extensions https://github.github.com/gfm/ - and has a few extras like Markdown Extra's footnotes https://michelf.ca/projects/php-markdown/extra/#footnotes - the scope suffix should indicate which flavor of Markdown the feature came from, to help make this syntax definition easier to maintain - file_extensions: - md - mdown @@ -17,177 +19,259 @@ file_extensions: - markdn variables: - thematic_break: |- - (?x: - [ ]{,3} # between 0 to 3 spaces - (?: # followed by one of the following: - [-](?:[ ]{,2}[-]){2,} # - a dash, followed by the following at least twice: between 0 to 2 spaces followed by a dash - | [*](?:[ ]{,2}[*]){2,} # - a star, followed by the following at least twice: between 0 to 2 spaces followed by a star - | [_](?:[ ]{,2}[_]){2,} # - an underscore, followed by the following at least twice: between 0 to 2 spaces followed by an underscore - ) - [ \t]*$ # followed by any number of tabs or spaces, followed by the end of the line - ) - block_quote: (?:[ ]{,3}(>)[ ]?) # between 0 and 3 spaces, followed by a greater than sign, (followed by any character or the end of the line = "only care about optional space!") - atx_heading: (?:[ ]{,3}[#]{1,6}(?:[ \t]|$)) # between 0 and 3 spaces, followed 1 to 6 hashes, followed by at least one space or tab or by end of the line - atx_heading_space: (?:(?=[ \t]+#+[ \t]*$)|[ \t]+|$) # consume spaces only if heading is not empty to ensure `atx_heading_end` can fully match closing hashes - atx_heading_end: (?:[ \t]+(#+))?[ \t]*($\n?) # \n is optional so ## is matched as end punctuation in new document (at eof) - setext_escape: ^(?=[ ]{,3}(?:=+|-+)\s*$) # between 0 and 3 spaces, followed by at least one hyphon or equal sign (setext underline can be of any length) - indented_code_block: (?:[ ]{4}|\t) # 4 spaces or a tab - list_item: (?:[ ]{,3}(?:\d+[.)]|[*+-])\s) # between 0 and 3 spaces, followed by either: at least one integer and a full stop or a parenthesis, or (a star, plus or dash), followed by whitespace - escape: '\\[-`*_#+.!(){}\[\]\\>|~<]' - backticks: |- - (?x: - (`{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 - | (`{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 - | (`{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 - | (`{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 - ) - balance_square_brackets: |- - (?x: - (?: - {{escape}}+ # escape characters - | [^\[\]`\\]+(?=[\[\]`\\]|$) # anything that isn't a square bracket or a backtick or the start of an escape character - | {{backticks}} # inline code - | \[(?: # nested square brackets (one level deep) - [^\[\]`]+(?=[\[\]`]) # anything that isn't a square bracket or a backtick - {{backticks}}? # balanced backticks - )*\] # closing square bracket - )+ # at least one character - ) - html_entity: '&([a-zA-Z0-9]+|#\d+|#x\h+);' - skip_html_tags: (?:<[^>]+>) - balance_square_brackets_and_emphasis: |- - (?x: - (?: - {{escape}}+ # escape characters - | [^\[\]`\\_*]+(?=[\[\]`\\_*]|$) # anything that isn't a square bracket, a backtick, the start of an escape character, or an emphasis character - | {{backticks}} # inline code - | \[(?: # nested square brackets (one level deep) - [^\[\]`]+(?=[\[\]`]) # anything that isn't a square bracket or a backtick - {{backticks}}? # balanced backticks - )*\] # closing square bracket - )+ # at least one character - ) - balance_square_brackets_pipes_and_emphasis: |- - (?x: - (?: - {{escape}}+ # escape characters - | [^\[\]`\\_*|]+(?=[\[\]`\\_*|]|$) # anything that isn't a square bracket, a backtick, the start of an escape character, or an emphasis character - | {{backticks}} # inline code - | \[(?: # nested square brackets (one level deep) - [^\[\]`]+(?=[\[\]`]) # anything that isn't a square bracket or a backtick - {{backticks}}? # balanced backticks - )*\] # closing square bracket - )+ # at least one character - ) - balanced_emphasis: |- - (?x: - \* (?!\*){{balance_square_brackets_and_emphasis}}+\* (?!\*) - | \*\* {{balance_square_brackets_and_emphasis}}+\*\* - | _ (?!_) {{balance_square_brackets_and_emphasis}}+_ (?!_) - | __ {{balance_square_brackets_and_emphasis}}+__ - ) - 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 - (?x: - (?: - {{balance_square_brackets_pipes_and_emphasis}} - | {{balanced_emphasis}} - )+ # at least one character - ) - table_first_row: |- - (?x: - # at least 2 non-escaped pipe chars on the line - (?:{{balanced_table_cell}}?\|){2} - - # something other than whitespace followed by a pipe char or hyphon, - # followed by something other than whitespace and the end of the line - | (?! \s*\-\s+ | \s+\|){{balanced_table_cell}}\|(?!\s+$) - ) - fenced_code_block_start: |- - (?x: - ([ \t]*) - ( - (`){3,} # 3 or more backticks - (?![^`]*`) # not followed by any more backticks on the same line - | # or - (~){3,} # 3 or more tildas - (?![^~]*~) # not followed by any more tildas on the same line - ) - \s* # allow for whitespace between code block start and info string - ) - fenced_code_block_language: |- - (?x: # first word of an infostring is used as language specifier - ( - [[:alpha:]] # starts with a letter to make sure not to hit any attribute annotation - [^`\s]* # optionally followed by any nonwhitespace character (except backticks) - ) + atx_heading: (?:[ ]{,3}[#]{1,6}(?:[ \t]|$)) # between 0 and 3 spaces, followed 1 to 6 hashes, followed by at least one space or tab or by end of the line + atx_heading_space: (?:(?=[ \t]+#+[ \t]*$)|[ \t]+|$) # consume spaces only if heading is not empty to ensure `atx_heading_end` can fully match closing hashes + atx_heading_end: (?:[ \t]+(#+))?[ \t]*($\n?) # \n is optional so ## is matched as end punctuation in new document (at eof) + setext_escape: ^(?=[ ]{,3}(?:=+|-+)\s*$) # between 0 and 3 spaces, followed by at least one hyphon or equal sign (setext underline can be of any length) + + block_quote: (?:[ ]{,3}(>)[ ]?) # between 0 and 3 spaces, followed by a greater than sign, (followed by any character or the end of the line = "only care about optional space!") + indented_code_block: (?:[ ]{4}|[ ]{0,3}\t) # a visual tab of width 4 consisting of 4 spaces or 0 to 3 spaces followed by 1 tab + + first_list_item: (?:[ ]{,3}(?:1[.)]|[*+-])\s) # between 0 and 3 spaces, followed by either: at least one integer and a full stop or a parenthesis, or (a star, plus or dash), followed by whitespace + list_item: (?:[ ]{,3}(?:\d{1,9}[.)]|[*+-])\s) # between 0 and 3 spaces, followed by either: at least one integer and a full stop or a parenthesis, or (a star, plus or dash), followed by whitespace + + thematic_break: |- + (?x: + [ ]{,3} # between 0 to 3 spaces + (?: # followed by one of the following: + [-](?:[ \t]*[-]){2,} # - a dash, followed by the following at least twice: any number of spaces or tabs followed by a dash + | [*](?:[ \t]*[*]){2,} # - a star, followed by the following at least twice: any number of spaces or tabs followed by a star + | [_](?:[ \t]*[_]){2,} # - an underscore, followed by the following at least twice: any number of spaces or tabs followed by an underscore ) - fenced_code_block_trailing_infostring_characters: |- - (?x: - ( - \s* # any whitespace, or .. - | - \s[^`]* # any characters (except backticks), separated by whitespace ... - ) - $\n? # ... until EOL - ) - code_fence_escape: ^{{code_fence_end}} - code_fence_end: |- - (?x: - [ \t]* - ( - \2 # the backtick/tilde combination that opened the code fence - (?:\3|\4)* # plus optional additional closing characters - ) - \s*$\n? # any amount of whitespace until EOL + [ \t]*$ # followed by any number of tabs or spaces, followed by the end of the line + ) + + backticks: |- + (?x: + (`{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 + | (`{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 + | (`{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 + | (`{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 + ) + escapes: \\[-+*/!"#$%&'(),.:;<=>?@\[\\\]^_`{|}~] + + balance_square_brackets: |- + (?x: + (?: + (?:{{escapes}})+ # escape characters + | [^\[\]`\\]+(?=[\[\]`\\]|$) # anything that isn't a square bracket or a backtick or the start of an escape character + | {{backticks}} # inline code + | \[(?: # nested square brackets (one level deep) + [^\[\]`]+(?=[\[\]`]) # anything that isn't a square bracket or a backtick + {{backticks}}? # balanced backticks + )*\] # closing square bracket + )+ + ) + balance_square_brackets_and_emphasis: |- + (?x: + (?: + (?:{{escapes}})+ # escape characters + | [^\[\]`\\_*]+(?=[\[\]`\\_*]|$) # anything that isn't a square bracket, a backtick, the start of an escape character, or an emphasis character + | {{backticks}} # inline code + | \[(?: # nested square brackets (one level deep) + [^\[\]`]+(?=[\[\]`]) # anything that isn't a square bracket or a backtick + {{backticks}}? # balanced backticks + )*\] # closing square bracket + )+ # at least one character + ) + balance_square_brackets_pipes_and_emphasis: |- + (?x: + (?: + (?:{{escapes}})+ # escape characters + | [^\[\]`\\_*|]+(?=[\[\]`\\_*|]|$) # anything that isn't a square bracket, a backtick, the start of an escape character, or an emphasis character + | {{backticks}} # inline code + | \[(?: # nested square brackets (one level deep) + [^\[\]`]+(?=[\[\]`]) # anything that isn't a square bracket or a backtick + {{backticks}}? # balanced backticks + )*\] # closing square bracket + )+ # at least one character + ) + balanced_emphasis: |- + (?x: + \* (?!\*){{balance_square_brackets_and_emphasis}}+\* (?!\*) + | \*\* {{balance_square_brackets_and_emphasis}}+\*\* + | _ (?!_) {{balance_square_brackets_and_emphasis}}+_ (?!_) + | __ {{balance_square_brackets_and_emphasis}}+__ + ) + + table_cell: |- + (?x: + # Pipes inside other inline spans (such as emphasis, code, etc.) will not break a cell, + # emphasis in table cells can't span multiple lines + (?: + {{balance_square_brackets_pipes_and_emphasis}} + | {{balanced_emphasis}} + )+ # at least one character + ) + table_first_row: |- + (?x: + # at least 2 non-escaped pipe chars on the line + (?:{{table_cell}}?\|){2} + + # something other than whitespace followed by a pipe char or hyphon, + # followed by something other than whitespace and the end of the line + | (?! \s*\-\s+ | \s+\|){{table_cell}}\|(?!\s+$) + ) + + fenced_code_block_start: |- + (?x: + ([ \t]*) + ( + (`){3,} # 3 or more backticks + (?![^`]*`) # not followed by any more backticks on the same line + | # or + (~){3,} # 3 or more tildas ) - html_tag_open_commonmark: |- - (?xi: - < - [a-z] # A tag name consists of an ASCII letter - [a-z0-9-]* # followed by zero or more ASCII letters, digits, or hyphens (-) - (?: # An attribute consists of whitespace, an attribute name, and an optional attribute value specification - \s+ - [a-z_:] # An attribute name consists of an ASCII letter, _, or : - [a-z0-9_.:-]* # followed by zero or more ASCII letters, digits, _, ., :, or - - (?: # An attribute value specification consists of optional whitespace, a = character, optional whitespace, and an attribute value - \s* - = - \s* - (?: - [^ @'=<>`]+ # An unquoted attribute value is a nonempty string of characters not including spaces, ", ', =, <, >, or ` - | '[^']*' # A single-quoted attribute value consists of ', zero or more characters not including ', and a final ' - | "[^"]*" # A double-quoted attribute value consists of ", zero or more characters not including ", and a final " - ) - )? - )* - \s* - /? - > + \s* # allow for whitespace between code block start and info string + ) + fenced_code_block_language: |- + (?x: # first word of an infostring is used as language specifier + ( + [[:alpha:]] # starts with a letter to make sure not to hit any attribute annotation + [^`\s]* # optionally followed by any nonwhitespace character (except backticks) ) - html_tag_close_commonmark: |- - (?xi: - + ) + fenced_code_block_trailing_infostring_characters: |- + (?x: + ( + \s* # any whitespace, or .. + | + \s[^`]* # any characters (except backticks), separated by whitespace ... ) - html_tag_block_end_at_close_tag: |- - (?xi: - (script|style|pre)\b + $\n? # ... until EOL + ) + fenced_code_block_end: |- + (?x: + [ \t]* + ( + \2 # the backtick/tilde combination that opened the code fence + (?:\3|\4)* # plus optional additional closing characters ) - html_tag_block_end_at_blank_line: |- - (?x: - /? - (?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) - (?:\s|$|/?>) + \s*$ # any amount of whitespace until EOL + ) + fenced_code_block_escape: ^{{fenced_code_block_end}} + + # https://spec.commonmark.org/0.30/#email-autolink + email_domain_commonmark: '[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?' + email_user_commonmark: '[a-zA-Z0-9.!#$%&''*+/=?^_`{|}~-]+' + + # https://spec.commonmark.org/0.30/#html-blocks + html_block: |- + (?x: + [ ]{,3} + (?: + {{html_tag_block_end_at_close_tag}} # html block type 1 + | {{html_tag_block_end_at_blank_line}} # html block type 6 + | {{html_block_open_tag}} # html block type 7 + | {{html_block_close_tag}} # html block type 7 + | {{html_block_comment}} # html block type 2 + | {{html_block_decl}} # html block type 4 + | {{html_block_cdata}} # html block type 5 + | {{html_block_preprocessor}} # html block type 3 ) - ascii_space: '\t\n\f ' - tag_attribute_name_start: (?=[^{{ascii_space}}=/>}]) - tag_attribute_name_break: (?=[{{ascii_space}}=/>}]) - tag_unquoted_attribute_start: (?=[^{{ascii_space}}=/>}]) - tag_unquoted_attribute_break: (?=[{{ascii_space}}}]|/?>) + ) + html_block_comment: <---> - # <= <== <=== <=> <==> <===> - - match: '>(-+|=+)[<>]?' # >- >-- >--- >-> >--> >---> >-< >--< >---< - # >= >== >=== >=> >==> >===> >=< >==< >===< - - match: '<<+|<>|>>+' # << <<< <<<< <> >>>> >>> >> + block-quote-punctuations: + - match: ^[ \t]{,3}(>)[ ]? + captures: + 1: punctuation.definition.blockquote.markdown + push: block-quote-punctuation-body - block-quotes: - # https://spec.commonmark.org/0.30/#block-quotes - - match: ^{{block_quote}} - comment: |- - We terminate the block quote when seeing an empty line, a - separator or a line with leading > characters. The latter is - to “reset” the quote level for quoted lines. - The idea here is to match block level elements first, then once - we have confirmed there are no block level elements left, move to - matching inline markdown. This prevents block level elements being - detected when they shouldn't be. + block-quote-punctuation-body: + - include: block-quote-punctuation-content + - include: immediately-pop + + block-quote-punctuation-content: + - match: '[ \t]{,3}(>)[ ]?' captures: 1: punctuation.definition.blockquote.markdown - push: - - block-quote-meta - - block-quote-content - block-quote-nested: - - match: '{{block_quote}}' + block-quote-nested-punctuations: + # Quotes signs in list items are not restricted by indentation level + # for technical reasons. + - match: ^[ \t]*(>)[ ]? captures: 1: punctuation.definition.blockquote.markdown - set: - - block-quote-meta - - block-quote-content + push: block-quote-nested-punctuation-body - block-quote-meta: - - meta_include_prototype: false - - meta_scope: markup.quote.markdown + block-quote-nested-punctuation-body: + - include: block-quote-nested-punctuation-content - include: immediately-pop - block-quote-content: - - include: block-quote-nested - - include: block-quote-code-block - - include: block-quote-list-item - - include: atx-heading - - include: indented-code-block - - include: thematic-break - - match: '' - set: block-quote-text + block-quote-nested-punctuation-content: + - match: '[ \t]*(>)[ ]?' + captures: + 1: punctuation.definition.blockquote.markdown - block-quote-code-block: +###[ CONTAINER BLOCKS: BLOCK QUOTES > FENCED CODE BLOCKS ]#################### + + block-quote-fenced-code-block: - match: |- (?x) {{fenced_code_block_start}} @@ -438,250 +398,370 @@ contexts: 0: meta.code-fence.definition.begin.text.markdown-gfm 2: punctuation.definition.raw.code-fence.begin.markdown 5: constant.other.language-name.markdown - set: block-quote-code-block-content + push: block-quote-fenced-code-block-body - block-quote-code-block-content: - - match: ^(?!\s*{{block_quote}}) - pop: true - - match: '{{code_fence_end}}' + block-quote-fenced-code-block-body: + - include: block-quote-fenced-code-block-end + - include: block-quote-fenced-code-block-content + + block-quote-fenced-code-block-content: + - include: block-quote-punctuation-content + - match: .*$\n? + scope: markup.raw.code-fence.markdown-gfm + + block-quote-fenced-code-block-end: + - include: block-quote-end + - match: '{{fenced_code_block_end}}' captures: 0: meta.code-fence.definition.end.text.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown pop: true - - match: '{{block_quote}}' + +###[ CONTAINER BLOCKS: BLOCK QUOTES > REFERENCE DEFINITIONS ]################# + + block-quote-reference-definitions: + # https://spec.commonmark.org/0.30/#link-reference-definitions + - include: block-quote-footnote-definitions + - include: block-quote-link-definitions + + block-quote-footnote-definitions: + # Mardown Extras Footnotes + - match: '([ \t]*)(\[)({{footnote_name}})(\])(:)' + captures: + 2: punctuation.definition.reference.begin.markdown + 3: entity.name.reference.link.markdown + 4: punctuation.definition.reference.end.markdown + 5: punctuation.separator.key-value.markdown + push: block-quote-footnote-def-body + + block-quote-footnote-def-body: + - meta_scope: meta.link.reference.def.footnote.markdown-extra + - include: block-quote-footnote-def-end + - include: block-quote-punctuations + - include: block-quote-footnote-paragraphs + + block-quote-footnote-def-end: + # A footnote definition is terminated by blocks not indented by at least 4 characters. + # Note: The first space after a quotation punctuation is not counted for simplicity reasons. + - match: ^(?!(?:[ \t]*>)+[ ](?:\1[ ]{4}|\s*$)) + pop: true + + block-quote-footnote-paragraphs: + - match: '[ \t]*(?=\S)' + push: block-quote-footnote-paragraph-body + + block-quote-footnote-paragraph-body: + - include: block-quote-footnote-paragraph-end + - include: block-quote-punctuations + - include: footnote-paragraph-common + + block-quote-footnote-paragraph-end: + - match: |- + (?x) + # pop out of this context if one of the following conditions are met: + ^(?= (?:[ \t]*>)* [ \t]* + (?: $ # the line is blank (or only contains whitespace) + | {{reference_definition}} # a reference definition begins the line + | {{atx_heading}} # an ATX heading begins the line + | {{fenced_code_block_start}} # a fenced codeblock begins the line + | {{thematic_break}} # line is a thematic beak + | {{list_item}} # a list item begins the line + | {{html_block}} # a html block begins the line + ) + ) + pop: true + + block-quote-link-definitions: + # https://spec.commonmark.org/0.30/#link-reference-definition + - match: '[ \t]*(\[)({{reference_name}})(\])(:)' captures: - 1: punctuation.definition.blockquote.markdown - - match: '' - push: block-quote-code-block-text + 1: punctuation.definition.reference.begin.markdown + 2: entity.name.reference.link.markdown + 3: punctuation.definition.reference.end.markdown + 4: punctuation.separator.key-value.markdown + push: + - block-quote-link-def-meta + - block-quote-link-def-title + - block-quote-link-def-url - block-quote-code-block-text: + block-quote-link-def-meta: - meta_include_prototype: false - - meta_content_scope: markup.raw.code-fence.markdown-gfm - - match: ^ + - meta_scope: meta.link.reference.def.markdown + - include: immediately-pop + + block-quote-link-def-title: + - include: block-quote-nested-paragraph-end + - include: block-quote-punctuations + - include: link-title-begin + - include: else-pop + + block-quote-link-def-url: + - include: block-quote-nested-paragraph-end + - include: block-quote-punctuations + - match: < + scope: punctuation.definition.link.begin.markdown + set: block-quote-link-def-url-angled + - match: (?=\S) + set: link-def-url-unquoted + + block-quote-link-def-url-angled: + - meta_content_scope: markup.underline.link.markdown + - include: block-quote-punctuations + - include: link-url-angled + +###[ CONTAINER BLOCKS: BLOCK QUOTES > LIST BLOCKS ]########################### + + block-quote-list-block: + - match: ([ \t]*)([*+-])((?:[ ](\[)([ xX])(\]))?\s) + captures: + 1: markup.list.unnumbered.markdown + 2: markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown + 3: markup.list.unnumbered.markdown + 4: markup.checkbox.begin.markdown-gfm punctuation.definition.checkbox.begin.markdown-gfm + 5: markup.checkbox.mark.markdown-gfm + 6: markup.checkbox.end.markdown-gfm punctuation.definition.checkbox.end.markdown-gfm + set: block-quote-unordered-list-block-body + - match: ([ \t]*)(\d{1,9}([.)]))(\s) + captures: + 1: markup.list.numbered.markdown + 2: markup.list.numbered.bullet.markdown + 3: punctuation.definition.list_item.markdown + 4: markup.list.numbered.markdown + set: block-quote-ordered-list-block-body + + block-quote-ordered-list-block-body: + - meta_content_scope: markup.list.numbered.markdown + - include: block-quote-list-block-end + - include: block-quote-list-block-content + + block-quote-unordered-list-block-body: + - meta_content_scope: markup.list.unnumbered.markdown + - include: block-quote-list-block-end + - include: block-quote-list-block-content + + block-quote-list-block-content: + - include: list-block-common + - include: block-quote-fenced-code-block + - include: block-quote-nested-punctuation-content + - include: block-quote-reference-definitions + - include: block-quote-list-paragraphs + + block-quote-list-block-end: + - include: block-quote-end + # A list block ends with the first unindented text block. + # Note: + # This is a simplification as we can't count indentation levels. + # According to CommonMark, a list block ends as soon as a new paragraph + # starts which is less indented than the first list item's text. + - match: ^(?=(?:[ \t]*>)+[ ]?\S) + pop: true + + block-quote-list-paragraphs: + # A list paragraph doesn't support indented code blocks. + - match: '[ \t]*(?=\S)' + push: block-quote-list-paragraph-body + + block-quote-list-paragraph-body: + - meta_scope: meta.paragraph.list.markdown + - include: block-quote-nested-paragraph-end + - include: block-quote-nested-punctuations + - include: inlines + + block-quote-nested-paragraph-end: + - match: |- + (?x) + # pop out of this context if one of the following conditions are met: + ^(?= (?:[ \t]*>)* [ \t]* + (?: $ # the line is blank (or only contains whitespace) + | {{atx_heading}} # an ATX heading begins the line + | {{fenced_code_block_start}} # a fenced codeblock begins the line + | {{thematic_break}} # line is a thematic beak + | {{list_item}} # a list item begins the line + | {{html_block}} # a html block begins the line + ) + ) + pop: true + +###[ CONTAINER BLOCKS: BLOCK QUOTES > PARAGRAPHS ]############################ + + block-quote-paragraph: + - match: '[ \t]*(?=\S)' + set: block-quote-paragraph-body + + block-quote-paragraph-body: + - meta_scope: markup.paragraph.markdown + - include: block-quote-paragraph-end + - include: block-quote-punctuations + - include: inlines + + block-quote-paragraph-end: + - match: |- + (?x) + # pop out of this context if one of the following conditions are met: + ^(?= (?:[ \t]{,3}>)* + (?: \s* $ # the line is blank (or only contains whitespace) + | {{atx_heading}} # an ATX heading begins the line + | {{fenced_code_block_start}} # a fenced codeblock begins the line + | {{thematic_break}} # line is a thematic beak + | {{list_item}} # a list item begins the line + | {{html_block}} # a html block begins the line + ) + ) pop: true - block-quote-list-item: - - match: ([ ]{,3})(\d+)(\.)(\s) +###[ CONTAINER BLOCKS: LISTS ]################################################ + + list-blocks: + - match: ([ \t]*)([*+-])((?:[ ](\[)([ xX])(\]))?\s) + captures: + 1: markup.list.unnumbered.markdown + 2: markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown + 3: markup.list.unnumbered.markdown + 4: markup.checkbox.begin.markdown-gfm punctuation.definition.checkbox.begin.markdown-gfm + 5: markup.checkbox.mark.markdown-gfm + 6: markup.checkbox.end.markdown-gfm punctuation.definition.checkbox.end.markdown-gfm + push: unordered-list-block + - match: ([ \t]*)(\d{1,9}([.)]))(\s) captures: 1: markup.list.numbered.markdown 2: markup.list.numbered.bullet.markdown - 3: markup.list.numbered.bullet.markdown punctuation.definition.list_item.markdown + 3: punctuation.definition.list_item.markdown 4: markup.list.numbered.markdown - set: - - block-quote-ordered-list-content - - list-content - - match: ([ ]{,3})([*+-])((?:[ ](\[[ xX]\]))?\s) + push: ordered-list-block + + unordered-list-block: + - meta_content_scope: markup.list.unnumbered.markdown + - include: list-block-end + - include: list-block-content + + ordered-list-block: + - meta_content_scope: markup.list.numbered.markdown + - include: list-block-end + - include: list-block-content + + list-block-end: + - match: ^(?=\S) + pop: true + + list-block-content: + - include: fenced-code-blocks + - include: html-blocks + - include: reference-definitions + - include: list-block-common + - include: list-block-quotes + - include: list-paragraphs + + list-block-common: + - include: thematic-breaks + - include: atx-headings + - include: list-items + + list-items: + - match: ([ \t]*)([*+-])((?:[ ](\[)([ xX])(\]))?\s) captures: 1: markup.list.unnumbered.markdown 2: markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown 3: markup.list.unnumbered.markdown - 4: constant.language.checkbox.markdown-gfm - set: - - block-quote-unordered-list-content - - list-content + 4: markup.checkbox.begin.markdown-gfm punctuation.definition.checkbox.begin.markdown-gfm + 5: markup.checkbox.mark.markdown-gfm + 6: markup.checkbox.end.markdown-gfm punctuation.definition.checkbox.end.markdown-gfm + - match: ([ \t]*)(\d{1,9}([.)]))(\s) + captures: + 1: markup.list.numbered.markdown + 2: markup.list.numbered.bullet.markdown + 3: punctuation.definition.list_item.markdown + 4: markup.list.numbered.markdown + + list-block-quotes: + - match: '[ \t]*(>)[ ]?' + captures: + 1: punctuation.definition.blockquote.markdown + push: + - block-quote-meta + - list-block-quote-body + - block-quote-punctuation-body + + list-block-quote-body: + - include: block-quote-end + - include: list-block-quote-punctuations + - include: list-block-quote-content + + list-block-quote-content: + - include: indented-code-blocks + - include: block-quote-common + - include: list-block-quote-paragraph + + list-block-quote-punctuations: + - match: ^[ \t]*(>)[ ]? + captures: + 1: punctuation.definition.blockquote.markdown + push: block-quote-punctuation-body + + list-block-quote-paragraph: + - match: '[ \t]*(?=\S)' + set: list-block-quote-paragraph-body + + list-block-quote-paragraph-body: + - meta_scope: markup.paragraph.markdown + - include: block-quote-nested-paragraph-end + - include: list-block-quote-punctuations + - include: inlines - block-quote-ordered-list-content: - - meta_content_scope: markup.list.numbered.markdown meta.paragraph.list.markdown - - include: block-quote-text + list-paragraphs: + - match: '[ \t]*(?=\S)' + push: list-paragraph-body - block-quote-unordered-list-content: - - meta_content_scope: markup.list.unnumbered.markdown meta.paragraph.list.markdown - - include: block-quote-text + list-paragraph-body: + - meta_scope: meta.paragraph.list.markdown + - include: list-paragraph-end + - include: inlines - block-quote-text: + list-paragraph-end: - match: |- (?x) - ^ - (?= \s*$ - | {{atx_heading}} - | {{block_quote}} - | {{fenced_code_block_start}} - | {{list_item}} - | {{thematic_break}} + # pop out of this context if one of the following conditions are met: + ^(?= [ \t]* + (?: $ # the line is blank (or only contains whitespace) + | {{block_quote}} # a blockquote begins the line + | {{atx_heading}} # an ATX heading begins the line + | {{fenced_code_block_start}} # a fenced codeblock begins the line + | {{thematic_break}} # line is a thematic beak + | {{list_item}} # a list item begins the line + | {{html_block}} # a html block begins the line + ) ) pop: true - - include: inline-bold-italic-linebreak - - include: scope:text.html.basic - indented-code-block: - - match: '{{indented_code_block}}.*$\n?' - scope: markup.raw.block.markdown - bold: - - include: ligatures - - match: '(\*\*)(\*)(?=\S)(?!\*)' - captures: - 1: punctuation.definition.bold.begin.markdown - 2: markup.italic.markdown punctuation.definition.italic.begin.markdown - push: - - meta_scope: markup.bold.markdown - - meta_content_scope: markup.italic.markdown - - match: |- - (?x) - [ \t]*\*{4,} # if there are more than 3 its not applicable to be bold or italic - | [ \t]+\*(?!\*) # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) - | ^\*(?!\*) # emphasis can't be closed at the start of the line - - match: (\*)(\*\*) - captures: - 1: markup.italic.markdown punctuation.definition.italic.end.markdown - 2: punctuation.definition.bold.end.markdown - pop: true - - match: \*\* - scope: punctuation.definition.bold.end.markdown - set: - - meta_content_scope: markup.italic.markdown - - match: |- - (?x) - [ \t]*\*{3,} # if there are more than 3 its not applicable to be bold or italic - | [ \t]+\*\*+ # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) - | ^\*\* # emphasis can't be closed at the start of the line - - match: \* - scope: markup.italic.markdown punctuation.definition.italic.end.markdown - pop: true - - include: format-common - - include: bold - - include: strikethrough - - match: \* - scope: punctuation.definition.italic.end.markdown - set: - - meta_content_scope: markup.bold.markdown - - match: |- - (?x) - [ \t]*\*{3,} # if there are more than 3 its not applicable to be bold or italic - | [ \t]+\*\*+ # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) - | ^\*\* # emphasis can't be closed at the start of the line - - match: \*\* - scope: markup.bold.markdown punctuation.definition.bold.end.markdown - pop: true - - include: format-common - - include: italic - - include: strikethrough - - include: format-common - - include: strikethrough - - match: '\*\*(?=\S)(?!\*\*|\*\s)' - scope: punctuation.definition.bold.begin.markdown - push: - - meta_scope: markup.bold.markdown - - match: |- - (?x) - [ \t]*\*{4,} # if there are more than 3 its not applicable to be bold or italic - | [ \t]+\*\*+ # whitespace followed by 2 or more is also not applicable - | ^\*\* # emphasis can't be closed at the start of the line - - match: (?:_)?(\*\*) - captures: - 1: punctuation.definition.bold.end.markdown - pop: true - # Consume 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 - - match: \b_(?=[^\s_])(?=[^*_]*\*\*) - - include: format-common - - include: italic - - include: strikethrough - - match: '\b(__)(_)(?=\S)(?!_)' - captures: - 1: punctuation.definition.bold.begin.markdown - 2: markup.italic.markdown punctuation.definition.italic.begin.markdown - push: - - meta_scope: markup.bold.markdown - - meta_content_scope: markup.italic.markdown - - match: |- - (?x) - [ \t]*_{4,} # if there are more than 3 its not applicable to be bold or italic - | [ \t]+_(?!_) # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) - | ^_(?!_) # emphasis can't be closed at the start of the line - - match: (_)(__)\b - captures: - 1: markup.italic.markdown punctuation.definition.italic.end.markdown - 2: punctuation.definition.bold.end.markdown - pop: true - - match: _\b - scope: punctuation.definition.italic.end.markdown - set: - - meta_content_scope: markup.bold.markdown - - match: |- - (?x) - [ \t]*_{3,} # if there are more than 3 its not applicable to be bold or italic - | [ \t]+__+ # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) - | ^__ # emphasis can't be closed at the start of the line - - match: __\b - scope: markup.bold.markdown punctuation.definition.bold.end.markdown - pop: true - - include: format-common - - include: italic - - include: strikethrough - - match: __\b - scope: punctuation.definition.bold.end.markdown - set: - - meta_content_scope: markup.italic.markdown - - match: |- - (?x) - [ \t]*_{3,} # if there are more than 3 its not applicable to be bold or italic - | [ \t]+__+ # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) - | ^__ # emphasis can't be closed at the start of the line - - match: _\b - scope: markup.italic.markdown punctuation.definition.italic.end.markdown - pop: true - - include: format-common - - include: bold - - include: strikethrough - - include: format-common - - include: strikethrough - - match: '\b__(?=\S)(?!_[_\s])' - scope: punctuation.definition.bold.begin.markdown - push: - - meta_scope: markup.bold.markdown - - match: |- - (?x) - [ \t]*_{4,} # if there are more than 3 its not applicable to be bold or italic - | [ \t]+__+ # whitespace followed by 2 or more is also not applicable - | ^__ # emphasis can't be closed at the start of the line - - match: (?:\*)?(__\b) - captures: - 1: punctuation.definition.bold.end.markdown - pop: true - # Consume 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 - - match: \*(?=[^\s*])(?=[^*_]*__\b) - - include: format-common - - include: italic - - include: strikethrough - bracket: - - match: '<(?![A-Za-z/?!$])' - comment: | - Markdown will convert this for us. We match it so that the - HTML grammar will not mark it up as invalid. - scope: meta.other.valid-bracket.markdown - escape: - - match: '{{escape}}' - scope: constant.character.escape.markdown +###[ LEAF BLOCKS: ATX HEADINGS ]############################################## - atx-heading: + atx-headings: # https://spec.commonmark.org/0.30/#atx-headings # Note: # Consume spaces and tabs after opening hashes so entity.name # starts with first non-whitespace character, # but don't do so if directly followed by closing hashes # as terminator pattern requires them to match then. - - match: '[ ]{,3}(#{1}){{atx_heading_space}}' + - match: '[ \t]*(#{1}){{atx_heading_space}}' captures: 1: punctuation.definition.heading.begin.markdown push: atx-heading1-content - - match: '[ ]{,3}(#{2}){{atx_heading_space}}' + - match: '[ \t]*(#{2}){{atx_heading_space}}' captures: 1: punctuation.definition.heading.begin.markdown push: atx-heading2-content - - match: '[ ]{,3}(#{3}){{atx_heading_space}}' + - match: '[ \t]*(#{3}){{atx_heading_space}}' captures: 1: punctuation.definition.heading.begin.markdown push: atx-heading3-content - - match: '[ ]{,3}(#{4}){{atx_heading_space}}' + - match: '[ \t]*(#{4}){{atx_heading_space}}' captures: 1: punctuation.definition.heading.begin.markdown push: atx-heading4-content - - match: '[ ]{,3}(#{5}){{atx_heading_space}}' + - match: '[ \t]*(#{5}){{atx_heading_space}}' captures: 1: punctuation.definition.heading.begin.markdown push: atx-heading5-content - - match: '[ ]{,3}(#{6}){{atx_heading_space}}' + - match: '[ \t]*(#{6}){{atx_heading_space}}' captures: 1: punctuation.definition.heading.begin.markdown push: atx-heading6-content @@ -722,478 +802,80 @@ contexts: 1: punctuation.definition.heading.end.markdown 2: meta.whitespace.newline.markdown pop: true - - include: inline-bold-italic - - image-inline: - - match: |- - (?x: - (\!\[) # Images start with ![ - (?= {{balance_square_brackets}}? # balanced square brackets, backticks, taking into account escapes etc. - \] # Closing square bracket - \( # Open paren - ) - ) - captures: - 1: meta.image.inline.markdown punctuation.definition.image.begin.markdown - push: [image-inline-attr, image-inline-after-text, image-link-text] - - image-link-text: - - meta_content_scope: meta.image.inline.description.markdown - - include: link-text - - match: \] - scope: meta.image.inline.markdown punctuation.definition.image.end.markdown - pop: true + - include: emphasis + - include: images + - include: literals + - include: links - image-inline-after-text: - - match: \( - scope: punctuation.definition.metadata.begin.markdown - set: - - meta_scope: meta.image.inline.markdown - - match: \) - scope: punctuation.definition.metadata.end.markdown - pop: true - - match: <(?=[^>)]*>) - scope: punctuation.definition.link.begin.markdown - push: - - meta_content_scope: markup.underline.link.image.markdown - - match: \> - scope: punctuation.definition.link.end.markdown - set: link-title - - match: \s+ - scope: invalid.illegal.unexpected-whitespace.markdown - - match: (?=\S) - set: - - meta_scope: meta.image.inline.markdown - - match: '[^\s)]+' - scope: markup.underline.link.image.markdown - - match: \) - scope: punctuation.definition.metadata.end.markdown - pop: true - - match: (?!\n)\s+(?!\s*(?:[)('"]|$)) - scope: invalid.illegal.unexpected-whitespace.markdown - - match: (?=\s*(?!\))) - push: link-title - - include: immediately-pop +###[ LEAF BLOCKS: SETEXT HEADINGS OR PARAGRAPH ]############################## - image-inline-attr: - - match: \{(?=[^}]*\}) - scope: punctuation.definition.attributes.begin.markdown - set: - - meta_scope: meta.image.inline.markdown - - include: tag-attributes - - include: immediately-pop + setext-headings-or-paragraphs: + # A paragraph may start with a line of equal signs which must not be matched + # as heading underline. This is achieved by consuming them here, which also + # applies `meta.paragraph` scope as expected. + # A line of dashes is already matched as thematic break and thus ignored. + - match: ^[ ]{,3}(?:=+|(?=\S)) + branch_point: setext-headings-or-paragraphs + branch: + - paragraph + - setext-heading2 + - setext-heading1 - image-ref: - - match: |- - (?x: - (\!\[) # Images start with ![ - (?= {{balance_square_brackets}}? # balanced square brackets, backticks, taking into account escapes etc. - \] # Closing square bracket - \[ # [ - [^\]]+ # anything other than ] - \] # ] - ) - ) + setext-heading1: + # https://spec.commonmark.org/0.30/#setext-headings + - meta_scope: markup.heading.1.markdown + - meta_content_scope: entity.name.section.markdown + - match: ^[ ]{,3}(=+)[ \t]*$(\n?) captures: - 1: meta.image.reference.markdown punctuation.definition.image.begin.markdown - push: [image-ref-attr, image-ref-after-text, image-ref-text] - - image-ref-text: - - meta_content_scope: meta.image.reference.description.markdown - - include: link-text - - match: \] - scope: meta.image.reference.markdown punctuation.definition.image.end.markdown + 1: punctuation.definition.heading.setext.markdown + 2: meta.whitespace.newline.markdown pop: true + - include: setext-heading-content - image-ref-after-text: - - match: (\[)([^\]]+)(\]) - captures: - 1: punctuation.definition.constant.begin.markdown - 2: constant.other.reference.link.markdown - 3: punctuation.definition.constant.end.markdown - scope: meta.image.reference.markdown - pop: true - - include: immediately-pop - - image-ref-attr: - - match: \{(?=[^}]*\}) - scope: punctuation.definition.attributes.begin.markdown - set: - - meta_scope: meta.image.reference.markdown - - include: tag-attributes - - include: immediately-pop - - inline: - - include: escape - - include: ampersand - - include: critic-inline - - include: ligatures - - include: bracket - - include: code-span - - include: link-ref-footnote - - include: image-inline - - include: link-inline - - include: autolink-inet - - include: autolink-email - - include: image-ref - - include: link-ref-literal - - include: link-ref - inline-bold-italic: - - include: inline - - include: bold - - include: italic - - include: strikethrough - inline-bold-italic-linebreak: - - include: inline-bold-italic - - include: hard-line-break - italic: - - match: '\*(?=\S)(?!\*)' - scope: punctuation.definition.italic.begin.markdown - push: - - meta_scope: markup.italic.markdown - - match: |- - (?x) - [ \t]*\*{4,} # if there are more than 3 its not applicable to be bold or italic - | [ \t]+\*(?!\*) # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) - | ^\*(?!\*) # emphasis can't be closed at the start of the line - - match: \*(?!\*[^*]) - scope: punctuation.definition.italic.end.markdown - pop: true - - match: \*+ - - include: format-common - - include: bold - - include: strikethrough - - match: '\b_(?=\S)(?!_)' - scope: punctuation.definition.italic.begin.markdown - push: - - meta_scope: markup.italic.markdown - - match: |- - (?x) - [ \t]*_{4,} # if there are more than 3 its not applicable to be bold or italic - | [ \t]+_(?!_) # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) - | ^_(?!_) # emphasis can't be closed at the start of the line - - match: _\b - scope: punctuation.definition.italic.end.markdown - pop: true - - include: format-common - - include: bold - - include: strikethrough - - match: '[*_]+' - - strikethrough: - - match: (?:~(?!~}|>|\s))+ # any number of ~ up to ~> or ~~} critic markers - scope: punctuation.definition.strikethrough.begin.markdown - push: strikethrough-content - - strikethrough-content: - - meta_scope: markup.strikethrough.markdown-gfm - - match: (?:~(?!~}|>))+ # any number of ~ up to ~> or ~~} critic markers - scope: punctuation.definition.strikethrough.end.markdown - pop: true - - include: format-common - - include: bold - - include: italic - - format-common: - - match: '{{setext_escape}}' - pop: true - - match: ^\s*$\n? - scope: invalid.illegal.non-terminated.bold-italic.markdown - pop: true - - include: paragraph-end - - include: hard-line-break - - include: inline - - include: scope:text.html.basic - - hard-line-break: - - match: '[ ]{2,}$' - scope: meta.hard-line-break.markdown punctuation.definition.hard-line-break.markdown - - match: '(\\)$\n' - scope: meta.hard-line-break.markdown - captures: - 1: constant.character.escape.markdown - - autolink-email: - - match: '(<)((?:mailto:)?[-+.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(>)' - scope: meta.link.email.lt-gt.markdown - captures: - 1: punctuation.definition.link.begin.markdown - 2: markup.underline.link.markdown - 4: punctuation.definition.link.end.markdown - - match: '[\w.+-]+@[\w-]+(\.((?![._-][\W])[\w_-])+)+(?![_-])' - scope: markup.underline.link.markdown - - autolink-inet: - - match: (<)((?:https?|ftp)://.*?)(>) - scope: meta.link.inet.markdown - captures: - 1: punctuation.definition.link.begin.markdown - 2: markup.underline.link.markdown - 3: punctuation.definition.link.end.markdown - - match: (((https|http|ftp)://)|www\.)[\w-]+(\.[\w-]+)+ - scope: markup.underline.link.markdown-gfm - push: # After a valid domain, zero or more non-space non-< characters may follow - - 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 - pop: true - - 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 - pop: true - - 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 - push: - - meta_scope: markup.underline.link.markdown-gfm - - match: (?=[?!.,:*_~]*[\s<]) - pop: true - - match: \) - pop: true - - match: (?=\)[?!.,:*_~]*[\s<]) - pop: true - - match: '[^?!.,:*_~\s<&()]+|\S' - scope: markup.underline.link.markdown-gfm - - link-inline: - - match: |- - (?x: - (\[) - (?= - {{balance_square_brackets}}? - \] - \( - ) - ) - captures: - 1: meta.link.inline.markdown punctuation.definition.link.begin.markdown - push: [link-inline-attr, link-inline-after-text, link-inline-link-text] - - link-inline-after-text: - - match: \( - scope: punctuation.definition.metadata.begin.markdown - set: - - meta_scope: meta.link.inline.markdown - - match: \) - scope: punctuation.definition.metadata.end.markdown - pop: true - - match: <(?=[^>)]*>) - scope: punctuation.definition.link.begin.markdown - push: - - match: \> - scope: punctuation.definition.link.end.markdown - set: link-title - - match: \s+ - scope: invalid.illegal.unexpected-whitespace.markdown - - match: (?=\S) - set: - - meta_scope: meta.link.inline.markdown - - match: '[^\s)]+' - scope: markup.underline.link.markdown - - match: \) - scope: punctuation.definition.metadata.end.markdown - pop: true - - match: (?!\n)\s+(?!\s*(?:[)('"]|$)) - scope: invalid.illegal.unexpected-whitespace.markdown - - match: (?=\s*(?!\))) - push: link-title - - include: immediately-pop - - link-inline-attr: - - match: \{(?=[^}]*\}) - scope: punctuation.definition.attributes.begin.markdown - set: - - meta_scope: meta.link.inline.markdown - - include: tag-attributes - - include: immediately-pop - - link-inline-link-text: - - meta_content_scope: meta.link.inline.description.markdown - - include: link-text-allow-image - - match: \] - scope: meta.link.inline.markdown punctuation.definition.link.end.markdown - pop: true - - link-ref: - - match: |- - (?x: - (\[) - (?= {{balance_square_brackets}}? # balanced square brackets, backticks, taking into account escapes etc. - \] # Closing square bracket - \[ # [ - [^\]]+ # anything other than ] - \] # ] - ) - ) - captures: - 1: meta.link.reference.markdown punctuation.definition.link.begin.markdown - push: [link-ref-attr, link-ref-after-text, link-ref-link-text] - - match: |- - (?x: - (\[)(?!\^) - (?= {{balance_square_brackets}}? # balanced square brackets, backticks, taking into account escapes etc. - \] - ) - ) - captures: - 1: meta.link.reference.markdown punctuation.definition.link.begin.markdown - push: link-ref-link-text - - link-ref-link-text: - - meta_content_scope: meta.link.reference.description.markdown - - include: link-text-allow-image - - match: \] - scope: meta.link.reference.markdown punctuation.definition.link.end.markdown - pop: true - - link-ref-after-text: - - match: (\[)([^\]]+)(\]) - scope: meta.link.reference.markdown + setext-heading2: + # https://spec.commonmark.org/0.30/#setext-headings + - meta_scope: markup.heading.2.markdown + - meta_content_scope: entity.name.section.markdown + - match: ^[ ]{,3}(-+)[ \t]*$(\n?) captures: - 1: punctuation.definition.constant.begin.markdown - 2: constant.other.reference.link.markdown - 3: punctuation.definition.constant.end.markdown + 1: punctuation.definition.heading.setext.markdown + 2: meta.whitespace.newline.markdown pop: true - - include: immediately-pop - - link-ref-attr: - - match: \{(?=[^}]*\}) - scope: punctuation.definition.attributes.begin.markdown - set: - - meta_scope: meta.link.reference.markdown - - include: tag-attributes - - include: immediately-pop + - include: setext-heading-content - link-ref-literal: - - match: |- - (?x: - (\[) - (?= - {{balance_square_brackets}}? # balanced square brackets, backticks, taking into account escapes etc. - \] # Closing square bracket - \[ # [ - \] # ] - ) - ) - captures: - 1: meta.link.reference.literal.markdown punctuation.definition.link.begin.markdown - push: [link-ref-literal-attr, link-ref-literal-after-text, link-ref-literal-link-text] + setext-heading-content: + - match: '{{setext_escape}}' + fail: setext-headings-or-paragraphs + - include: emphasis + - include: images + - include: literals + - include: links + - include: markups - link-ref-literal-link-text: - - meta_content_scope: meta.link.reference.literal.description.markdown - - include: link-text-allow-image - - match: \] - scope: meta.link.reference.literal.markdown punctuation.definition.link.end.markdown - pop: true + paragraph: + # https://spec.commonmark.org/0.30/#paragraphs + - meta_scope: meta.paragraph.markdown + - match: '{{setext_escape}}' + fail: setext-headings-or-paragraphs + - include: paragraph-end + - include: inlines - link-ref-literal-after-text: - - match: (\[)(\]) - scope: meta.link.reference.literal.markdown - captures: - 1: punctuation.definition.constant.begin.markdown - 2: punctuation.definition.constant.end.markdown + paragraph-end: + - match: '{{paragraph_end}}' pop: true - - include: immediately-pop - link-ref-literal-attr: - - match: \{(?=[^}]*\}) - scope: punctuation.definition.attributes.begin.markdown - set: - - meta_scope: meta.link.reference.literal.markdown - - include: tag-attributes - - include: immediately-pop +###[ LEAF BLOCKS: INDENTED CODE BLOCKS ]###################################### - link-ref-footnote: - - match: |- - (?x: - (\[\^) - ([^]]+) - (\]) - ) - captures: - 0: meta.link.reference.footnote.markdown-extra - 1: punctuation.definition.link.begin.markdown - 2: meta.link.reference.literal.footnote-id.markdown - 3: punctuation.definition.link.end.markdown + indented-code-blocks: + # https://spec.commonmark.org/0.30/#indented-code-blocks + - match: '{{indented_code_block}}.*$\n?' + scope: markup.raw.block.markdown - reference-link-definition: - - match: |- - (?x: - [ ]{0,3} # Leading whitespace - (\[)(|(?:\\\]|[^]])+)(\])(:) # Reference name - [ \t]* # Optional whitespace - (?: - (<)([^>]*)(>) # The url - | (\S+) # The url - ) - ) - captures: - 1: punctuation.definition.constant.begin.markdown - 2: entity.name.reference.link.markdown - 3: punctuation.definition.constant.end.markdown - 4: punctuation.separator.key-value.markdown - 5: punctuation.definition.link.begin.markdown - 6: markup.underline.link.markdown - 7: punctuation.definition.link.end.markdown - 8: markup.underline.link.markdown - push: [link-ref-def-expect-end, link-title] - - list-paragraph: - - match: '^(?=(?:[ ]{4}|\t){2,}(?![>+*\s-]))(?={{indented_code_block}})' - push: - - include: indented-code-block - - match: $ - pop: true - - match: ^[ ]*{{block_quote}} - captures: - 1: punctuation.definition.blockquote.markdown - push: - - block-quote-meta - - block-quote-content - - include: fenced-code-blocks - - include: reference-link-definition - - match: \s+(?=\S) - push: - - match: ^\s*$ - pop: true - - match: ([ ]*)([*+-])((?:[ ](\[[ xX]\]))?\s) - captures: - 1: markup.list.unnumbered.markdown - 2: markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown - 3: markup.list.unnumbered.markdown - 4: constant.language.checkbox.markdown-gfm - push: - - clear_scopes: 1 - - meta_content_scope: markup.list.unnumbered.markdown meta.paragraph.list.markdown - - include: list-content - - match: ([ ]*)(\d+([.)]))(?=\s) - captures: - 1: markup.list.numbered.markdown - 2: markup.list.numbered.bullet.markdown - 3: punctuation.definition.list_item.markdown - push: - - clear_scopes: 1 - - meta_content_scope: markup.list.numbered.markdown meta.paragraph.list.markdown - - include: list-content - - match: \s+ - scope: meta.paragraph.list.markdown - - match: (?=^{{atx_heading}}) - pop: true - - match: '(?=\S)' - push: list-content - - match: '(?=\S)' - pop: true - list-content: - - meta_content_scope: meta.paragraph.list.markdown - - include: fenced-code-blocks - - match: ^ - pop: true - - include: thematic-break - - match: (?=\S)(?!{{list_item}}) - push: - - match: (?={{list_item}}) - pop: true - - include: inline-bold-italic-linebreak - - include: scope:text.html.basic - - match: $ - pop: true +###[ LEAF BLOCKS: FENCED CODE BLOCKS ]######################################## fenced-code-blocks: - - match: ^(?={{fenced_code_block_start}}) + # https://spec.commonmark.org/0.30/#fenced-code-blocks + - match: (?={{fenced_code_block_start}}) push: fenced-code-block-content fenced-code-block-content: @@ -1203,11 +885,15 @@ contexts: - include: fenced-raw fenced-syntaxes: + - include: fenced-actionscript + - include: fenced-applescript - include: fenced-clojure - include: fenced-c - include: fenced-cpp - include: fenced-csharp + - include: fenced-css - include: fenced-diff + - include: fenced-dosbatch - include: fenced-erlang - include: fenced-graphviz - include: fenced-golang @@ -1233,6 +919,7 @@ contexts: - include: fenced-ruby - include: fenced-rust - include: fenced-scala + - include: fenced-shell - include: fenced-shell-script - include: fenced-sql - include: fenced-tsx @@ -1240,6 +927,40 @@ contexts: - include: fenced-xml - include: fenced-yaml + fenced-actionscript: + - match: |- + (?x) + {{fenced_code_block_start}} + ((?i:actionscript|as)) + {{fenced_code_block_trailing_infostring_characters}} + captures: + 0: meta.code-fence.definition.begin.actionscript.markdown-gfm + 2: punctuation.definition.raw.code-fence.begin.markdown + 5: constant.other.language-name.markdown + embed: scope:source.actionscript.2 + embed_scope: markup.raw.code-fence.actionscript.markdown-gfm + escape: '{{fenced_code_block_escape}}' + escape_captures: + 0: meta.code-fence.definition.end.actionscript.markdown-gfm + 1: punctuation.definition.raw.code-fence.end.markdown + + fenced-applescript: + - match: |- + (?x) + {{fenced_code_block_start}} + ((?i:applescript|osascript)) + {{fenced_code_block_trailing_infostring_characters}} + captures: + 0: meta.code-fence.definition.begin.applescript.markdown-gfm + 2: punctuation.definition.raw.code-fence.begin.markdown + 5: constant.other.language-name.markdown + embed: scope:source.applescript + embed_scope: markup.raw.code-fence.applescript.markdown-gfm + escape: '{{fenced_code_block_escape}}' + escape_captures: + 0: meta.code-fence.definition.end.applescript.markdown-gfm + 1: punctuation.definition.raw.code-fence.end.markdown + fenced-clojure: - match: |- (?x) @@ -1252,7 +973,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.clojure embed_scope: markup.raw.code-fence.clojure.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.clojure.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1261,7 +982,7 @@ contexts: - match: |- (?x) {{fenced_code_block_start}} - ((?i:c)) + ((?i:c|h)) {{fenced_code_block_trailing_infostring_characters}} captures: 0: meta.code-fence.definition.begin.c.markdown-gfm @@ -1269,7 +990,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.c embed_scope: markup.raw.code-fence.c.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.c.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1278,7 +999,7 @@ contexts: - match: |- (?x) {{fenced_code_block_start}} - ((?i:c\+\+|cpp)) + ((?i:c\+\+|cc|cpp|cxx|h\+\+|hpp|hxx)) {{fenced_code_block_trailing_infostring_characters}} captures: 0: meta.code-fence.definition.begin.c++.markdown-gfm @@ -1286,7 +1007,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.c++ embed_scope: markup.raw.code-fence.c++.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.c++.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1303,11 +1024,28 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.cs embed_scope: markup.raw.code-fence.csharp.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.csharp.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown + fenced-css: + - match: |- + (?x) + {{fenced_code_block_start}} + ((?i:css)) + {{fenced_code_block_trailing_infostring_characters}} + captures: + 0: meta.code-fence.definition.begin.css.markdown-gfm + 2: punctuation.definition.raw.code-fence.begin.markdown + 5: constant.other.language-name.markdown + embed: scope:source.css + embed_scope: markup.raw.code-fence.css.markdown-gfm + escape: '{{fenced_code_block_escape}}' + escape_captures: + 0: meta.code-fence.definition.end.css.markdown-gfm + 1: punctuation.definition.raw.code-fence.end.markdown + fenced-diff: - match: |- (?x) @@ -1320,11 +1058,28 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.diff embed_scope: markup.raw.code-fence.diff.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.diff.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown + fenced-dosbatch: + - match: |- + (?x) + {{fenced_code_block_start}} + ((?i:bat|cmd|dos)) + {{fenced_code_block_trailing_infostring_characters}} + captures: + 0: meta.code-fence.definition.begin.dosbatch.markdown-gfm + 2: punctuation.definition.raw.code-fence.begin.markdown + 5: constant.other.language-name.markdown + embed: scope:source.dosbatch + embed_scope: markup.raw.code-fence.dosbatch.markdown-gfm + escape: '{{fenced_code_block_escape}}' + escape_captures: + 0: meta.code-fence.definition.end.dosbatch.markdown-gfm + 1: punctuation.definition.raw.code-fence.end.markdown + fenced-erlang: - match: |- (?x) @@ -1337,7 +1092,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.erlang embed_scope: markup.raw.code-fence.erlang.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.erlang.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1354,7 +1109,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.dot embed_scope: markup.raw.code-fence.graphviz.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.graphviz.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1371,7 +1126,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.go embed_scope: markup.raw.code-fence.go.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.go.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1388,7 +1143,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.haskell embed_scope: markup.raw.code-fence.haskell.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.haskell.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1405,7 +1160,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:embedding.php embed_scope: markup.raw.code-fence.html-php.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.html-php.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1422,7 +1177,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:text.html.basic embed_scope: markup.raw.code-fence.html.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.html.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1439,7 +1194,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.java embed_scope: markup.raw.code-fence.java.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.java.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1456,7 +1211,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.js embed_scope: markup.raw.code-fence.javascript.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.javascript.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1473,7 +1228,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.json embed_scope: markup.raw.code-fence.json.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.json.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1490,7 +1245,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:text.html.jsp embed_scope: markup.raw.code-fence.jsp.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.jsp.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1507,7 +1262,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.jsx embed_scope: markup.raw.code-fence.jsx.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.jsx.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1524,7 +1279,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.lisp embed_scope: markup.raw.code-fence.lisp.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.lisp.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1541,7 +1296,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.lua embed_scope: markup.raw.code-fence.lua.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.lua.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1558,7 +1313,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.matlab embed_scope: markup.raw.code-fence.matlab.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.matlab.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1575,7 +1330,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.objc embed_scope: markup.raw.code-fence.objc.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.objc.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1592,7 +1347,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.objc++ embed_scope: markup.raw.code-fence.objc++.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.objc++.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1609,7 +1364,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.ocaml embed_scope: markup.raw.code-fence.ocaml.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.ocaml.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1626,7 +1381,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.perl embed_scope: markup.raw.code-fence.perl.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.perl.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1643,7 +1398,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.php embed_scope: markup.raw.code-fence.php.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.php.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1660,7 +1415,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.python embed_scope: markup.raw.code-fence.python.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.python.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1677,7 +1432,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.regexp embed_scope: markup.raw.code-fence.regexp.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.regexp.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1694,7 +1449,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.r embed_scope: markup.raw.code-fence.r.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.r.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1711,7 +1466,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.ruby embed_scope: markup.raw.code-fence.ruby.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.ruby.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1728,7 +1483,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.rust embed_scope: markup.raw.code-fence.rust.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.rust.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1745,16 +1500,33 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.scala embed_scope: markup.raw.code-fence.scala.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.scala.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown + fenced-shell: + - match: |- + (?x) + {{fenced_code_block_start}} + ((?i:console|shell)) + {{fenced_code_block_trailing_infostring_characters}} + captures: + 0: meta.code-fence.definition.begin.shell.markdown-gfm + 2: punctuation.definition.raw.code-fence.begin.markdown + 5: constant.other.language-name.markdown + embed: scope:source.shell.interactive.markdown + embed_scope: markup.raw.code-fence.shell.markdown-gfm + escape: '{{fenced_code_block_escape}}' + escape_captures: + 0: meta.code-fence.definition.end.shell.markdown-gfm + 1: punctuation.definition.raw.code-fence.end.markdown + fenced-shell-script: - match: |- (?x) {{fenced_code_block_start}} - ((?i:shell(?:-script)?|sh|bash|zsh)) + ((?i:shell-script|sh|bash|zsh)) {{fenced_code_block_trailing_infostring_characters}} captures: 0: meta.code-fence.definition.begin.shell-script.markdown-gfm @@ -1762,7 +1534,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.shell.bash embed_scope: markup.raw.code-fence.shell-script.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.shell-script.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1779,7 +1551,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.sql embed_scope: markup.raw.code-fence.sql.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.sql.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1796,7 +1568,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.tsx embed_scope: markup.raw.code-fence.tsx.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.tsx.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1813,7 +1585,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.ts embed_scope: markup.raw.code-fence.typescript.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.typescript.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1822,7 +1594,7 @@ contexts: - match: |- (?x) {{fenced_code_block_start}} - ((?i:xml)) + ((?i:atom|plist|svg|xjb|xml|xsd|xsl)) {{fenced_code_block_trailing_infostring_characters}} captures: 0: meta.code-fence.definition.begin.xml.markdown-gfm @@ -1830,7 +1602,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:text.xml embed_scope: markup.raw.code-fence.xml.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.xml.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1847,7 +1619,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.yaml embed_scope: markup.raw.code-fence.yaml.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.yaml.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1866,129 +1638,926 @@ contexts: fenced-raw-content: - meta_content_scope: markup.raw.code-fence.markdown-gfm - - match: '{{code_fence_escape}}' + - match: '{{fenced_code_block_escape}}' captures: 0: meta.code-fence.definition.end.text.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown pop: true - code-span: - - match: (`+)(?!`) - scope: punctuation.definition.raw.begin.markdown +###[ LEAF BLOCKS: HTML BLOCKS ]############################################### + + # https://spec.commonmark.org/0.30/#html-blocks + html-blocks: + # Markdown formatting is disabled inside block-level tags. + - match: ^[ \t]*(?=<((?i:pre|textarea)){{html_tag_break_char}}) push: - - meta_scope: markup.raw.inline.markdown - - match: \1(?!`) - scope: punctuation.definition.raw.end.markdown - pop: true - - match: '`+' - - match: ^\s*$\n? - scope: invalid.illegal.non-terminated.raw.markdown - pop: true - - include: paragraph-end - - thematic-break: - - match: (?={{thematic_break}}) + - html-block-pop-at-eol + - html-block-type-1a + # Markdown formatting is disabled inside block-level tags. + - match: ^[ \t]*(?=<((?i:script|style)){{html_tag_break_char}}) + push: + - html-block-pop-at-eol + - html-block-type-1b + # Markdown formatting is disabled inside block level tags and if a complete HTML tag is the only thing on the line. + - match: ^[ \t]*(?={{html_tag_block_end_at_blank_line}}|{{html_block_open_tag}}|{{html_block_close_tag}}) + push: html-block-type-6 + # Markdown formatting is disabled inside comments. + - match: ^[ \t]*(?={{html_block_comment}}) + push: + - html-block-pop-at-eol + - html-block-type-2 + # Markdown formatting is disabled inside preprocessor instructions. + - match: ^[ \t]*(?={{html_block_preprocessor}}) + push: + - html-block-pop-at-eol + - html-block-type-3 + # Markdown formatting is disabled inside doctype declarations. + - match: ^[ \t]*(?={{html_block_decl}}) push: - - meta_scope: meta.separator.thematic-break.markdown - - match: '[-_*]+' - scope: punctuation.definition.thematic-break.markdown - - match: '$\n?' - pop: true + - html-block-pop-at-eol + - html-block-type-4 + # Markdown formatting is disabled inside CDATA. + - match: ^[ \t]*(?={{html_block_cdata}}) + push: + - html-block-pop-at-eol + - html-block-type-5 - disable-markdown: - - include: scope:text.html.basic - disable-markdown-pop-at-tag: + html-block-type-1a: - match: () captures: - 1: meta.tag.block.any.html punctuation.definition.tag.begin.html - 2: meta.tag.block.any.html entity.name.tag.block.any.html - 3: meta.tag.block.any.html punctuation.definition.tag.end.html + 0: meta.tag.block.any.html + 1: punctuation.definition.tag.begin.html + 2: entity.name.tag.block.any.html + 3: punctuation.definition.tag.end.html pop: true - - include: disable-markdown - disable-markdown-pop-after-tag: - - match: (?!) pop: true - - include: disable-markdown - disable-markdown-pop-after-cdata: - - match: (?! pop: true - - include: disable-markdown - disable-markdown-pop-after-html-doctype: - - match: (?!' pop: true - - include: disable-markdown - link-text: - - match: \b__?(?=[^]_]+\]) # eat underscores where there is no pair before the end of the square brackets - it's not a formatting mark - - match: \b\*\*?(?=[^]*]+\]) # eat asterisks where there is no pair before the end of the square brackets - it's not a formatting mark - - include: escape - - include: ampersand - - include: code-span - - match: \[ # nested square brackets are allowed - push: - - include: link-text - - match: \] - pop: true - - include: bold - - include: italic - - include: hard-line-break - - include: scope:text.html.basic - link-text-allow-image: - - include: link-text - - include: image-inline - - include: image-ref - link-title: - - match: \' - scope: punctuation.definition.string.begin.markdown - set: - - meta_scope: string.other.link.description.title.markdown - - match: \' - scope: punctuation.definition.string.end.markdown - pop: true - - include: non-terminated-link-title - - match: \" - scope: punctuation.definition.string.begin.markdown - set: - - meta_scope: string.other.link.description.title.markdown - - match: \" - scope: punctuation.definition.string.end.markdown - pop: true - - include: non-terminated-link-title - - match: \( - scope: punctuation.definition.string.begin.markdown - set: - - meta_scope: string.other.link.description.title.markdown - - match: \) - scope: punctuation.definition.string.end.markdown - pop: true - - include: non-terminated-link-title - - match: $|(?=\S) - pop: true - non-terminated-link-title: - - match: ^\s*$\n? - scope: invalid.illegal.non-terminated.link-title.markdown + + html-block-type-5: + - match: (?!{{html_block_cdata}}) pop: true - link-ref-def-expect-end: - - meta_scope: meta.link.reference.def.markdown - - match: $ + - include: html-content + + html-block-type-6: + - meta_scope: meta.disable-markdown + - match: ^\s*\n pop: true - - match: \s*\S+ + - include: html-content + + html-block-pop-at-eol: + - meta_scope: meta.disable-markdown + - match: $\n? + pop: true + - include: html-content + + html-content: + - include: scope:text.html.basic + + html-entities: + # https://spec.commonmark.org/0.30/#entity-and-numeric-character-references + - include: scope:text.html.basic#entities + +###[ LEAF BLOCKS: LINK REFERENCE DEFINITIONS ]################################ + + reference-definitions: + # https://spec.commonmark.org/0.30/#link-reference-definitions + - include: footnote-definitions + - include: link-definitions + + footnote-definitions: + # Mardown Extras Footnotes + - match: '([ \t]*)(\[)({{footnote_name}})(\])(:)' + captures: + 2: punctuation.definition.reference.begin.markdown + 3: entity.name.reference.link.markdown + 4: punctuation.definition.reference.end.markdown + 5: punctuation.separator.key-value.markdown + push: footnote-def-body + + footnote-def-body: + - meta_scope: meta.link.reference.def.footnote.markdown-extra + - include: footnote-def-end + - include: footnote-paragraphs + + footnote-def-end: + - match: ^(?!(?:\1[ ]{4}|\s*$)) + pop: true + + footnote-paragraphs: + - match: '[ \t]*(?=\S)' + push: footnote-paragraph-body + + footnote-paragraph-body: + - include: footnote-paragraph-end + - include: footnote-paragraph-common + + footnote-paragraph-common: + - include: emphasis + - include: images + - include: literals + - include: links + + footnote-paragraph-end: + - match: |- + (?x) + # pop out of this context if one of the following conditions are met: + ^(?= [ \t]* + (?: $ # the line is blank (or only contains whitespace) + | {{reference_definition}} # a reference definition begins the line + | {{atx_heading}} # an ATX heading begins the line + | {{fenced_code_block_start}} # a fenced codeblock begins the line + | {{thematic_break}} # line is a thematic beak + | {{list_item}} # a list item begins the line + | {{html_block}} # a html block begins the line + ) + ) + pop: true + + link-definitions: + # https://spec.commonmark.org/0.30/#link-reference-definition + - match: '[ \t]*(\[)({{reference_name}})(\])(:)' + captures: + 1: punctuation.definition.reference.begin.markdown + 2: entity.name.reference.link.markdown + 3: punctuation.definition.reference.end.markdown + 4: punctuation.separator.key-value.markdown + push: + - link-def-end + - link-def-title + - link-def-url + + link-def-end: + - meta_include_prototype: false + - meta_scope: meta.link.reference.def.markdown + - include: immediately-pop + + link-def-title: + - match: ^(?!\s*["'(]) + pop: true + - match: (?=["'(]) + set: + - expect-eol + - link-title + - match: \S.+ scope: invalid.illegal.expected-eol.markdown -###[ LINK/IMAGE/REFERENCE ATTRIBUTES ]######################################## + link-def-url: + - match: < + scope: punctuation.definition.link.begin.markdown + set: link-def-url-angled + - match: (?=\S) + set: link-def-url-unquoted + - include: paragraph-end + + link-def-url-angled: + - meta_content_scope: markup.underline.link.markdown + - include: link-url-angled + + link-def-url-unquoted: + - meta_scope: markup.underline.link.markdown + # URLs are terminated by whitespace or newline in reference definitions + # Note: \s includes \n + - match: (?=\s) + pop: true + - include: link-url-common + +###[ LEAF BLOCKS: TABLES ]#################################################### + + tables: + - match: ^(?={{table_first_row}}) + push: table-header + + table-header: + - meta_content_scope: meta.table.header.markdown-gfm + - match: \n + set: table-header-separator-begin + - include: table-cell-content + + table-header-separator-begin: + - match: ^(?=[-|:\s]+$) + set: table-header-separator + - match: ^ + pop: true + + table-header-separator: + - meta_content_scope: meta.table.header-separator.markdown-gfm + - match: \n + set: table-body + - match: -+ + scope: punctuation.section.table-header.markdown + - match: ':' + scope: punctuation.definition.table-cell-alignment.markdown + - include: table-cell-separators + + table-body: + - meta_content_scope: meta.table.markdown-gfm + - include: table-end + - include: table-cell-content + + table-end: + # The table is broken at the first empty line, or beginning of another block-level structure + - match: |- + (?x)^ + (?= \s*$ + | {{atx_heading}} + | {{block_quote}} + | {{fenced_code_block_start}} + | {{indented_code_block}} + | {{thematic_break}} + ) + pop: true + + table-cell-content: + - match: (?={{balanced_emphasis}}) + push: table-cell-emphasis + - match: (?!{{backticks}})`+ + scope: invalid.deprecated.unescaped-backticks.markdown + - include: table-cell-separators + - include: images + - include: literals + - include: links + - include: markups + + table-cell-emphasis: + - include: emphasis + - include: immediately-pop + + table-cell-separators: + - match: \| + scope: punctuation.separator.table-cell.markdown + +###[ LEAF BLOCKS: THEMATIC BREAKS ]########################################### + + thematic-breaks: + # https://spec.commonmark.org/0.30/#thematic-breaks + - match: (?={{thematic_break}}) + push: thematic-break-body + + thematic-break-body: + - meta_include_prototype: false + - meta_scope: meta.separator.thematic-break.markdown + - match: '[-_*]+' + scope: punctuation.definition.thematic-break.markdown + - match: \n + pop: true + +###[ INLINE ]################################################################# + + inlines: + - include: hard-line-breaks + - include: emphasis + - include: images + - include: literals + - include: links + - include: markups + + emphasis: + - include: bold + - include: italic + - include: strikethrough + + images: + - include: image-inline + - include: image-ref + + literals: + - include: code-spans + - include: critics + - include: escapes + + links: + - include: autolink-email + - include: autolink-inet + - include: link-ref-wiki + - include: link-ref-footnote + - include: link-ref-literal + - include: link-inline + - include: link-ref + + markups: + # Markdown will convert this for us. We match it so that the + # HTML grammar will not mark it up as invalid. + - match: '[<>](-+|=+)[<>]?' + - match: '[<>]?(-+|=+)[<>]' + - match: '<<+|<>|>>+' + - match: <(?![A-Za-z/?!]) + - include: html-content + +###[ INLINE: CODE SPANS ]##################################################### + + code-spans: + # https://spec.commonmark.org/0.30/#code-spans + - match: (`+)(?!`) + scope: punctuation.definition.raw.begin.markdown + push: code-span-body + + code-span-body: + - meta_scope: markup.raw.inline.markdown + - match: \1(?!`) + scope: punctuation.definition.raw.end.markdown + pop: true + - match: '`+' + - match: ^\s*$\n? + scope: invalid.illegal.non-terminated.raw.markdown + pop: true + - include: paragraph-end + +###[ INLINE: EMPHASIS ]####################################################### + + bold: + # https://spec.commonmark.org/0.30/#emphasis-and-strong-emphasis + - match: '{{bold_italic_asterisk_begin}}' + captures: + 1: punctuation.definition.bold.begin.markdown + 2: markup.italic.markdown punctuation.definition.italic.begin.markdown + 3: punctuation.definition.bold.begin.markdown + 4: markup.italic.markdown punctuation.definition.italic.begin.markdown + push: bold-italic-asterisk + - match: '{{bold_asterisk_begin}}' + scope: punctuation.definition.bold.begin.markdown + push: bold-asterisk + - match: \b(__)(_)(?=\S)(?!_) + captures: + 1: punctuation.definition.bold.begin.markdown + 2: markup.italic.markdown punctuation.definition.italic.begin.markdown + push: bold-italic-underscore + - match: \b__(?=\S)(?!_[_\s]) + scope: punctuation.definition.bold.begin.markdown + push: bold-underscore + + bold-asterisk: + - meta_scope: markup.bold.markdown + - match: |- + (?x) + [ \t]*\*{4,} # if there are more than 3 its not applicable to be bold or italic + | [ \t]+\*\*+ # whitespace followed by 2 or more is also not applicable + | ^\*\* # emphasis can't be closed at the start of the line + - match: (?:_)?(\*\*) + captures: + 1: punctuation.definition.bold.end.markdown + pop: true + # Consume 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 + - match: \b_(?=[^\s_])(?=[^*_]*\*\*) + - include: bold-common + + bold-underscore: + - meta_scope: markup.bold.markdown + - match: |- + (?x) + [ \t]*_{4,} # if there are more than 3 its not applicable to be bold or italic + | [ \t]+__+ # whitespace followed by 2 or more is also not applicable + | ^__ # emphasis can't be closed at the start of the line + - match: (?:\*)?(__\b) + captures: + 1: punctuation.definition.bold.end.markdown + pop: true + # Consume 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 + - match: \*(?=[^\s*])(?=[^*_]*__\b) + - include: bold-common + + bold-italic-asterisk: + - meta_scope: markup.bold.markdown + - meta_content_scope: markup.italic.markdown + - match: |- + (?x) + [ \t]*\*{4,} # if there are more than 3 its not applicable to be bold or italic + | [ \t]+\*(?!\*) # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) + | ^\*(?!\*) # emphasis can't be closed at the start of the line + - match: (\*)(\*\*) + captures: + 1: markup.italic.markdown punctuation.definition.italic.end.markdown + 2: punctuation.definition.bold.end.markdown + pop: true + - match: \*\* + scope: punctuation.definition.bold.end.markdown + set: italic-after-bold-italic-asterisk + - match: \* + scope: punctuation.definition.italic.end.markdown + set: bold-after-bold-italic-asterisk + - include: emphasis-common + - include: strikethrough + + bold-after-bold-italic-asterisk: + - meta_content_scope: markup.bold.markdown + - match: |- + (?x) + [ \t]*\*{3,} # if there are more than 3 its not applicable to be bold or italic + | [ \t]+\*\*+ # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) + | ^\*\* # emphasis can't be closed at the start of the line + - match: \*\* + scope: markup.bold.markdown punctuation.definition.bold.end.markdown + pop: true + - include: bold-common + + italic-after-bold-italic-asterisk: + - meta_content_scope: markup.italic.markdown + - match: |- + (?x) + [ \t]*\*{3,} # if there are more than 3 its not applicable to be bold or italic + | [ \t]+\*\*+ # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) + | ^\*\* # emphasis can't be closed at the start of the line + - match: \* + scope: markup.italic.markdown punctuation.definition.italic.end.markdown + pop: true + - include: italic-common + + bold-italic-underscore: + - meta_scope: markup.bold.markdown + - meta_content_scope: markup.italic.markdown + - match: |- + (?x) + [ \t]*_{4,} # if there are more than 3 its not applicable to be bold or italic + | [ \t]+_(?!_) # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) + | ^_(?!_) # emphasis can't be closed at the start of the line + - match: (_)(__)\b + captures: + 1: markup.italic.markdown punctuation.definition.italic.end.markdown + 2: punctuation.definition.bold.end.markdown + pop: true + - match: _\b + scope: punctuation.definition.italic.end.markdown + set: bold-after-bold-italic-underscore + - match: __\b + scope: punctuation.definition.bold.end.markdown + set: italic-after-bold-italic-underscore + - include: emphasis-common + - include: strikethrough + + bold-after-bold-italic-underscore: + - meta_content_scope: markup.bold.markdown + - match: |- + (?x) + [ \t]*_{3,} # if there are more than 3 its not applicable to be bold or italic + | [ \t]+__+ # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) + | ^__ # emphasis can't be closed at the start of the line + - match: __\b + scope: markup.bold.markdown punctuation.definition.bold.end.markdown + pop: true + - include: bold-common + + italic-after-bold-italic-underscore: + - meta_content_scope: markup.italic.markdown + - match: |- + (?x) + [ \t]*_{3,} # if there are more than 3 its not applicable to be bold or italic + | [ \t]+__+ # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) + | ^__ # emphasis can't be closed at the start of the line + - match: _\b + scope: markup.italic.markdown punctuation.definition.italic.end.markdown + pop: true + - include: italic-common + + bold-common: + - include: emphasis-common + - include: italic + - include: strikethrough + + italic: + - match: '{{italic_asterisk_begin}}' + scope: punctuation.definition.italic.begin.markdown + push: italic-asterisk + - match: \b_(?=\S)(?!_) + scope: punctuation.definition.italic.begin.markdown + push: italic-underscore + - match: '[*_]+' + + italic-asterisk: + - meta_scope: markup.italic.markdown + - match: |- + (?x) + [ \t]*\*{4,} # if there are more than 3 its not applicable to be bold or italic + | [ \t]+\*(?!\*) # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) + | ^\*(?!\*) # emphasis can't be closed at the start of the line + - match: \*(?!\*[^*]) + scope: punctuation.definition.italic.end.markdown + pop: true + - match: \*+ + - include: italic-common + + italic-underscore: + - meta_scope: markup.italic.markdown + - match: |- + (?x) + [ \t]*_{4,} # if there are more than 3 its not applicable to be bold or italic + | [ \t]+_(?!_) # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) + | ^_(?!_) # emphasis can't be closed at the start of the line + - match: _\b + scope: punctuation.definition.italic.end.markdown + pop: true + - include: italic-common + + italic-common: + - include: emphasis-common + - include: bold + - include: strikethrough + + strikethrough: + # https://github.github.com/gfm/#strikethrough-extension- + - match: ~~(?![~}>\s]) # 2x ~ but no ~> or ~~} + scope: punctuation.definition.strikethrough.begin.markdown + push: strikethrough-content + - match: ~+(?![~}>\s]) # any number of ~ not looking like ~> or ~~} + + strikethrough-content: + - meta_scope: markup.strikethrough.markdown-gfm + - match: ~~(?:(?!~)|(?=~~}|~>)) # 2x ~ maybe followed by ~> or ~~} + scope: punctuation.definition.strikethrough.end.markdown + pop: true + - match: ~+(?:(?!~)|(?=~~}|~>)) # any number of ~ maybe followed by ~> or ~~} + - include: emphasis-common + - include: bold + - include: italic + + emphasis-common: + - match: '{{setext_escape}}' + pop: true + - match: ^\s*$\n? + scope: invalid.illegal.non-terminated.bold-italic.markdown + pop: true + - include: paragraph-end + - include: hard-line-breaks + - include: images + - include: literals + - include: links + - include: markups + +###[ INLINE: IMAGES ]######################################################### + + image-inline: + - match: \!\[(?={{balance_square_brackets}}?\]\() + scope: punctuation.definition.image.begin.markdown + push: + - image-inline-metadata + - image-inline-text + + image-inline-text: + - meta_scope: meta.image.inline.description.markdown + - match: \] + scope: punctuation.definition.image.end.markdown + pop: true + - include: link-text + + image-inline-metadata: + - match: \( + scope: punctuation.definition.metadata.begin.markdown + set: + - image-inline-metadata-end + - link-title + - image-inline-url + - include: immediately-pop + + image-inline-metadata-end: + - meta_scope: meta.image.inline.metadata.markdown + - match: \) + scope: punctuation.definition.metadata.end.markdown + set: image-inline-attr + - include: else-pop + + image-inline-url: + - match: < + scope: punctuation.definition.link.begin.markdown + set: image-inline-url-angled + - match: (?=\S) + set: image-inline-url-unquoted + + image-inline-url-angled: + - meta_content_scope: markup.underline.link.image.markdown + - include: link-url-angled + + image-inline-url-unquoted: + - meta_scope: markup.underline.link.image.markdown + - include: link-url-unquoted + + image-inline-attr: + - match: \{(?=[^}]*\}) + scope: punctuation.definition.attributes.begin.markdown + set: image-inline-attr-body + - include: immediately-pop + + image-inline-attr-body: + - meta_scope: meta.image.inline.attributes.markdown + - include: tag-attributes + + image-ref: + - match: \!\[(?={{balance_square_brackets}}?\]\[{{reference_name}}\]) + scope: punctuation.definition.image.begin.markdown + push: + - image-ref-attr + - image-ref-metadata + - image-ref-text + + image-ref-text: + - meta_scope: meta.image.reference.description.markdown + - match: \] + scope: punctuation.definition.image.end.markdown + pop: true + - include: link-text + + image-ref-metadata: + - match: (\[)({{reference_name}})(\]) + scope: meta.image.reference.metadata.markdown + captures: + 1: punctuation.definition.metadata.begin.markdown + 2: markup.underline.link.markdown + 3: punctuation.definition.metadata.end.markdown + pop: true + - include: immediately-pop + + image-ref-attr: + - match: \{(?=[^}]*\}) + scope: punctuation.definition.attributes.begin.markdown + set: image-ref-attr-body + - include: immediately-pop + + image-ref-attr-body: + - meta_scope: meta.image.reference.markdown + - include: tag-attributes + +###[ INLINE: LINKS ]########################################################## + + link-inline: + - match: \[(?={{balance_square_brackets}}?\]\() + scope: punctuation.definition.link.begin.markdown + push: + - link-inline-metadata + - link-inline-text + + link-inline-text: + - meta_scope: meta.link.inline.description.markdown + - match: \] + scope: punctuation.definition.link.end.markdown + pop: true + - include: link-text-allow-image + + link-inline-metadata: + - match: \( + scope: punctuation.definition.metadata.begin.markdown + set: + - link-inline-metadata-end + - link-title + - link-inline-url + - include: immediately-pop + + link-inline-metadata-end: + - meta_scope: meta.link.inline.metadata.markdown + - match: \) + scope: punctuation.definition.metadata.end.markdown + set: link-inline-attr + - include: else-pop + + link-inline-url: + - match: < + scope: punctuation.definition.link.begin.markdown + set: link-inline-url-angled + - match: (?=\S) + set: link-inline-url-unquoted + + link-inline-url-angled: + - meta_content_scope: markup.underline.link.markdown + - include: link-url-angled + + link-inline-url-unquoted: + - meta_scope: markup.underline.link.markdown + - include: link-url-unquoted + + link-inline-attr: + - match: \{(?=[^}]*\}) + scope: punctuation.definition.attributes.begin.markdown + set: link-inline-attr-body + - include: immediately-pop + + link-inline-attr-body: + - meta_scope: meta.link.inline.attributes.markdown + - include: tag-attributes + + link-ref: + - match: \[(?={{balance_square_brackets}}?\]\[{{reference_name}}\]) + scope: punctuation.definition.link.begin.markdown + push: + - link-ref-attr + - link-ref-metadata + - link-ref-link-text + - match: \[(?={{balance_square_brackets}}?\]) + scope: punctuation.definition.link.begin.markdown + push: link-ref-link-text + + link-ref-link-text: + - meta_scope: meta.link.reference.description.markdown + - match: \] + scope: punctuation.definition.link.end.markdown + pop: true + - include: link-text-allow-image + + link-ref-metadata: + - match: (\[)({{reference_name}})(\]) + scope: meta.link.reference.metadata.markdown + captures: + 1: punctuation.definition.metadata.begin.markdown + 2: markup.underline.link.markdown + 3: punctuation.definition.metadata.end.markdown + pop: true + - include: immediately-pop + + link-ref-attr: + - match: \{(?=[^}]*\}) + scope: punctuation.definition.attributes.begin.markdown + set: link-ref-attr-body + - include: immediately-pop + + link-ref-attr-body: + - meta_scope: meta.link.reference.attributes.markdown + - include: tag-attributes + + link-ref-literal: + - match: \[(?={{balance_square_brackets}}?\]\[\]) + scope: punctuation.definition.link.begin.markdown + push: + - link-ref-literal-attr + - link-ref-literal-metadata + - link-ref-literal-link-text + + link-ref-literal-link-text: + - meta_scope: meta.link.reference.literal.description.markdown + - match: \] + scope: punctuation.definition.link.end.markdown + pop: true + - include: link-text-allow-image + + link-ref-literal-metadata: + - match: (\[)(\]) + scope: meta.link.reference.literal.metadata.markdown + captures: + 1: punctuation.definition.metadata.begin.markdown + 2: punctuation.definition.metadata.end.markdown + pop: true + - include: immediately-pop + + link-ref-literal-attr: + - match: \{(?=[^}]*\}) + scope: punctuation.definition.attributes.begin.markdown + set: link-ref-literal-attr-body + - include: immediately-pop + + link-ref-literal-attr-body: + - meta_scope: meta.link.reference.literal.attributes.markdown + - include: tag-attributes + + link-ref-footnote: + - match: (\[)({{footnote_name}})(\]) + captures: + 0: meta.link.reference.footnote.markdown-extra + 1: punctuation.definition.link.begin.markdown + 2: meta.link.reference.literal.footnote-id.markdown + 3: punctuation.definition.link.end.markdown + + link-ref-wiki: + - match: \[\[(?={{balance_square_brackets}}?\]\]) + scope: punctuation.definition.link.begin.markdown + push: link-ref-wiki-link-text + + link-ref-wiki-link-text: + - meta_scope: meta.link.reference.wiki.description.markdown + - match: \]\] + scope: punctuation.definition.link.end.markdown + pop: true + - include: link-text-allow-image + +###[ INLINE: LINK/IMAGE PROTOTYPES ]########################################## + + link-text: + - match: \[ + push: link-text-nested + - match: \b__?(?=[^]_]+\]) # eat underscores where there is no pair before the end of the square brackets - it's not a formatting mark + - match: \b\*\*?(?=[^]*]+\]) # eat asterisks where there is no pair before the end of the square brackets - it's not a formatting mark + - include: emphasis + - include: literals + - include: markups + + link-text-nested: + - include: link-text + - match: \] + pop: true + + link-text-allow-image: + - include: link-text + - include: images + + link-title: + - include: link-title-begin + - include: eol-pop + - include: else-pop + + link-title-begin: + - match: \' + scope: punctuation.definition.string.begin.markdown + set: link-title-single-quoted-content + - match: \" + scope: punctuation.definition.string.begin.markdown + set: link-title-double-quoted-content + - match: \( + scope: punctuation.definition.string.begin.markdown + set: link-title-other-quoted-content + + link-title-double-quoted-content: + - meta_scope: meta.string.title.markdown string.quoted.double.markdown + - match: \" + scope: punctuation.definition.string.end.markdown + pop: true + - include: link-title-common + + link-title-single-quoted-content: + - meta_scope: meta.string.title.markdown string.quoted.single.markdown + - match: \' + scope: punctuation.definition.string.end.markdown + pop: true + - include: link-title-common + + link-title-other-quoted-content: + - meta_scope: meta.string.title.markdown string.quoted.other.markdown + - match: \) + scope: punctuation.definition.string.end.markdown + pop: true + - include: link-title-common + + link-title-common: + - match: ^\s*$\n? + scope: invalid.illegal.non-terminated.link-title.markdown + pop: true + - include: escapes + - include: html-entities + + link-url-angled: + - match: \> + scope: punctuation.definition.link.end.markdown + pop: true + - include: link-url-common + + link-url-unquoted: + - match: (?=[ \t)]) + pop: true + - match: \( + push: link-url-unquoted-parens + - include: link-url-common + + link-url-unquoted-parens: + - match: \) + pop: true + - include: link-url-unquoted + + link-url-common: + - include: escapes + - include: html-entities + - include: link-url-path-separators + - include: link-url-scheme-separators + - include: link-url-escapes + - include: paragraph-end + + link-url-escapes: + - match: (%)\h{2} + scope: constant.character.escape.url.markdown + captures: + 1: punctuation.definition.escape.markdown + + link-url-path-separators: + - match: '[/&?#]' + scope: punctuation.separator.path.markdown + + link-url-scheme-separators: + - match: ':/{,2}' + scope: punctuation.separator.path.markdown + + link-url-scheme-separator: + - match: ':/{,2}' + scope: punctuation.separator.path.markdown + pop: true + +###[ INLINE: LINK/IMAGE/REFERENCE ATTRIBUTES ]################################ tag-attributes: # https://kramdown.gettalong.org/syntax.html#span-ials @@ -1998,7 +2567,7 @@ contexts: scope: punctuation.definition.attributes.end.markdown pop: true - match: \, - scope: punctuation.separator.mapping.pair.markdown + scope: punctuation.separator.sequence.markdown - match: '{{tag_attribute_name_start}}' push: [tag-attr-meta, tag-attr-equals, tag-attr-name] @@ -2022,144 +2591,201 @@ contexts: tag-attr-value: - match: \" scope: punctuation.definition.string.begin.markdown - set: - - meta_scope: string.quoted.double.markdown - - match: \" - scope: punctuation.definition.string.end.markdown - pop: true + set: tag-attr-value-double-quoted - match: \' scope: punctuation.definition.string.begin.markdown - set: - - meta_scope: string.quoted.single.markdown - - match: \' - scope: punctuation.definition.string.end.markdown - pop: true + set: tag-attr-value-single-quoted - match: '{{tag_unquoted_attribute_start}}' - set: - - meta_scope: string.unquoted.markdown - - match: '{{tag_unquoted_attribute_break}}' - pop: true - - match: '["''`<]' - scope: invalid.illegal.attribute-value.markdown + set: tag-attr-value-unquoted - include: else-pop -###[ TABLE ]################################################################## + tag-attr-value-double-quoted: + - meta_scope: string.quoted.double.markdown + - match: \" + scope: punctuation.definition.string.end.markdown + pop: true - table: - - match: ^(?={{table_first_row}}) + tag-attr-value-single-quoted: + - meta_scope: string.quoted.single.markdown + - match: \' + scope: punctuation.definition.string.end.markdown + pop: true + + tag-attr-value-unquoted: + - meta_scope: string.unquoted.markdown + - match: '{{tag_unquoted_attribute_break}}' + pop: true + - match: '["''`<]' + scope: invalid.illegal.attribute-value.markdown + +###[ INLINE: AUTOLINKS ]###################################################### + + autolink-email: + # CommonMark + # https://spec.commonmark.org/0.30/#email-autolink + - match: |- + (?x) + (<) + ( + (?:mailto(:))? + {{email_user_commonmark}} + (@) + {{email_domain_commonmark}}(?:\.{{email_domain_commonmark}})* + ) + (>) + captures: + 0: meta.link.email.markdown + 1: punctuation.definition.link.begin.markdown + 2: markup.underline.link.markdown + 3: punctuation.separator.path.markdown + 4: punctuation.separator.path.markdown + 5: punctuation.definition.link.end.markdown + # Github Flavoured Markdown + - match: '[\w.+-]+(@)[\w-]+(?:\.(?:(?![._-][\W])[\w_-])+)+(?![_-])' + captures: + 0: meta.link.email.markdown markup.underline.link.markdown + 1: punctuation.separator.path.markdown + + autolink-inet: + # CommonMark + # https://spec.commonmark.org/0.30/#autolinks + - match: <(?=[[:alpha:]][[:alnum:].+-]+:) + scope: punctuation.definition.link.begin.markdown push: - - meta_content_scope: meta.table.header.markdown-gfm - - match: \| - scope: punctuation.separator.table-cell.markdown - - include: inline-bold-italic - - match: $\n? - set: - - match: ^ - set: - - meta_content_scope: meta.table.header-separator.markdown-gfm - - match: \| - scope: punctuation.separator.table-cell.markdown - - match: ':' - scope: punctuation.definition.table-cell-alignment.markdown - - match: -+ - scope: punctuation.section.table-header.markdown - - match: $\n? - set: - - meta_content_scope: meta.table.markdown-gfm - - match: |- # The table is broken at the first empty line, or beginning of another block-level structure - (?x)^ - (?= {{block_quote}} - | {{indented_code_block}}(?!$) - | {{atx_heading}} - | {{thematic_break}} - | \s*$ - ) - pop: true - - match: \| - scope: punctuation.separator.table-cell.markdown - - match: (?={{balanced_emphasis}}) - push: - - include: bold - - include: italic - - match: '' - pop: true - - match: |- - (?x) - (?!{{backticks}}) - `+ - scope: invalid.deprecated.unescaped-backticks.markdown - - include: inline - - include: scope:text.html.basic - -###[ CRITIC MARKUP ]########################################################## - - critic-inline: + - autolink-inet-angled-content + - link-url-scheme-separator + # Github Flavoured Markdown + # After a valid domain, zero or more non-space non-< characters may follow + - match: (?:(?:https|http|ftp)(://)|www\.)[\w-]+ + captures: + 1: punctuation.separator.path.markdown + push: autolink-inet-unquoted-content + + autolink-inet-angled-content: + - meta_scope: meta.link.inet.markdown + - meta_content_scope: markup.underline.link.markdown + - match: \> + scope: punctuation.definition.link.end.markdown + pop: true + # Spaces are not allowed in autolinks + - match: (?=\s) + pop: true + - include: autolink-inet-common + + autolink-inet-unquoted-content: + - meta_scope: meta.link.inet.markdown markup.underline.link.markdown-gfm + # 1. 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 + # 2. 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 + # 3. Trailing punctuation (specifically, ?, !, ., ,, :, *, _, and ~) will not + # be considered part of the autolink, though they may be included in the + # interior # of the link + - match: (?=(?:\)|(?:{{html_entity}})*)[?!.,:*_~]*[\s<]) + pop: true + - include: autolink-inet-common + + autolink-inet-group: + - match: \) + pop: true + - match: (?=(?:{{html_entity}})*[?!.,:*_~]*[\s<]) + pop: true + - include: autolink-inet-common + + autolink-inet-common: + - match: \( + push: autolink-inet-group + - include: link-url-path-separators + - include: link-url-escapes + +###[ INLINE: OTHER ]########################################################## + + escapes: + # https://spec.commonmark.org/0.30/#backslash-escapes + - match: '{{escapes}}' + scope: constant.character.escape.markdown + + hard-line-breaks: + # https://spec.commonmark.org/0.30/#hard-line-breaks + - match: '[ ]{2,}$' + scope: meta.hard-line-break.markdown punctuation.definition.hard-line-break.markdown + - match: (\\)\n + captures: + 0: meta.hard-line-break.markdown + 1: constant.character.escape.markdown + +###[ EXTENSIONS: CRITIC MARKUP ]############################################## + + critics: # inline critic markup # http://criticmarkup.com/spec.php - - include: critic-inline-additions - - include: critic-inline-comments - - include: critic-inline-deletions - - include: critic-inline-highlights - - include: critic-inline-substitutions + - include: critics-additions + - include: critics-comments + - include: critics-deletions + - include: critics-highlights + - include: critics-substitutions - critic-inline-additions: + critics-additions: - match: \{\+\+ scope: punctuation.definition.critic.begin.markdown - push: critic-inline-addition-content + push: critics-addition-content - critic-inline-addition-content: + critics-addition-content: - meta_scope: markup.critic.addition.markdown - meta_content_scope: markup.inserted.critic.markdown - match: \+\+\} scope: punctuation.definition.critic.end.markdown pop: true - - include: critic-inline-common + - include: critics-common - critic-inline-comments: + critics-comments: - match: '{>>' scope: punctuation.definition.critic.begin.markdown - push: critic-inline-comment-content + push: critics-comment-content - critic-inline-comment-content: + critics-comment-content: - meta_scope: markup.critic.comment.markdown - meta_content_scope: comment.critic.markdown - match: '<<}' scope: punctuation.definition.critic.end.markdown pop: true - - include: critic-inline-common + - include: critics-common - critic-inline-deletions: + critics-deletions: - match: '{--' scope: punctuation.definition.critic.begin.markdown - push: critic-inline-deletion-content + push: critics-deletion-content - critic-inline-deletion-content: + critics-deletion-content: - meta_scope: markup.critic.deletion.markdown - meta_content_scope: markup.deleted.critic.markdown - match: '--}' scope: punctuation.definition.critic.end.markdown pop: true - - include: critic-inline-common + - include: critics-common - critic-inline-highlights: + critics-highlights: - match: '{==' scope: punctuation.definition.critic.begin.markdown - push: critic-inline-highlight-content + push: critics-highlight-content - critic-inline-highlight-content: + critics-highlight-content: - meta_scope: markup.critic.highlight.markdown - meta_content_scope: markup.info.critic.markdown - match: '==}' scope: punctuation.definition.critic.end.markdown pop: true - - include: critic-inline-common + - include: critics-common - critic-inline-substitutions: + critics-substitutions: - match: '{~~' scope: punctuation.definition.critic.begin.markdown - push: critic-inline-substitution-deleted + push: critics-substitution-deleted - critic-inline-substitution-deleted: + critics-substitution-deleted: - meta_scope: markup.critic.substitution.markdown - meta_content_scope: markup.deleted.critic.markdown - match: (?=~>) @@ -2167,21 +2793,24 @@ contexts: - meta_include_prototype: false - match: '~>' scope: punctuation.separator.critic.markdown - set: critic-inline-substitution-inserted - - include: critic-inline-substitution-inserted + set: critics-substitution-inserted + - include: critics-substitution-inserted - critic-inline-substitution-inserted: + critics-substitution-inserted: - meta_scope: markup.critic.substitution.markdown - meta_content_scope: markup.inserted.critic.markdown - match: '~~}' scope: punctuation.definition.critic.end.markdown pop: true - - include: critic-inline-common + - include: critics-common - critic-inline-common: + critics-common: - match: ^(?=\s*$) pop: true - - include: inline-bold-italic + - include: emphasis + - include: images + - include: literals + - include: links ###[ PROTOTYPES ]############################################################# @@ -2189,6 +2818,16 @@ contexts: - match: (?=\S) pop: true + eol-pop: + - match: $ + pop: true + + expect-eol: + - include: eol-pop + - match: \S.+ + scope: invalid.illegal.expected-eol.markdown + immediately-pop: - match: '' pop: true + diff --git a/Markdown/MultiMarkdown.sublime-syntax b/Markdown/MultiMarkdown.sublime-syntax index aa56414e5f..d571b32da3 100644 --- a/Markdown/MultiMarkdown.sublime-syntax +++ b/Markdown/MultiMarkdown.sublime-syntax @@ -1,29 +1,37 @@ %YAML 1.2 --- -# http://www.sublimetext.com/docs/3/syntax.html -version: 2 name: MultiMarkdown -first_line_match: (?i)^format:\s*complete\s*$ scope: text.html.markdown.multimarkdown + +extends: Packages/Markdown/Markdown.sublime-syntax + +first_line_match: (?i:^format:\s*complete\s*$) + variables: - header: ((?=[A-Za-z0-9])[\w -]+)(:) + header: ([A-Za-z0-9][\w -]*)(:) + contexts: main: - - match: '^{{header}}\s*' + - match: ^(?={{header}}) + push: multimarkdown-header + - match: ^ + set: multimarkdown-content + + multimarkdown-header: + - match: ^$ + pop: 1 + - match: ^(?:{{header}}\s*)? captures: 1: keyword.other.multimarkdown 2: punctuation.separator.key-value.multimarkdown - push: - - meta_scope: meta.header.multimarkdown - - match: '^$|^(?={{header}})' - pop: true - - match: .+ - comment: | - The reason for not setting scopeName = "string.unquoted" - (for the parent rule) is that we do not want - newlines to be marked as string.unquoted - scope: string.unquoted.multimarkdown - - match: '' - push: - - - meta_scope: meta.content.multimarkdown - - scope:text.html.markdown + push: multimarkdown-header-value + + multimarkdown-header-value: + - meta_scope: meta.header.multimarkdown + - meta_content_scope: string.unquoted.multimarkdown + - match: \n + pop: 1 + + multimarkdown-content: + - meta_scope: meta.content.multimarkdown + - include: markdown diff --git a/Markdown/Shell (for Markdown).sublime-syntax b/Markdown/Shell (for Markdown).sublime-syntax new file mode 100644 index 0000000000..4abc326da9 --- /dev/null +++ b/Markdown/Shell (for Markdown).sublime-syntax @@ -0,0 +1,29 @@ +%YAML 1.2 +--- +name: Interactive Unix Shell +scope: source.shell.interactive.markdown +version: 2 +hidden: true + +extends: Packages/ShellScript/Shell-Unix-Generic.sublime-syntax + +contexts: + prototype: + - meta_prepend: true + # continuation lines begin with `> ` + - match: ^\s*(>)\s + captures: + 1: comment.other.shell + scope: comment.other.shell + + main: + - match: ^(?=\s*\$\s) + push: shell-interactive + - include: statements + + shell-interactive: + - match: ^\s*(\$)(?=\s) + captures: + 1: comment.other.shell + embed: statements + escape: (? -|^^^^^^^^^^^^^^^^^^^^^^^ markup.heading.2.markdown -|^^ - entity.name.section -| ^^^^^^^^^^^^^^^^^^^^ entity.name.section.markdown -| ^ - entity.name.section - -https://spec.commonmark.org/0.30/#example-75 -# #heading# # -| <- markup.heading.1.markdown punctuation.definition.heading.begin.markdown -|^^^^^^^^^^^^^ meta.block-level.markdown markup.heading.1.markdown -|^ - entity.name.section -| ^^^^^^^^^ entity.name.section.markdown -| ^^ - entity.name.section -| ^ punctuation.definition.heading.end.markdown - -https://spec.commonmark.org/0.30/#example-76 -## heading \## -| <- markup.heading.2.markdown punctuation.definition.heading.begin.markdown -|^^^^^^^^^^^^^^ meta.block-level.markdown markup.heading.2.markdown -|^^ - entity -| ^^^^^^^^^^^ entity.name.section.markdown -| ^^ constant.character.escape.markdown -| ^^^ - punctuation -| ^ - entity.name.section - -https://spec.commonmark.org/0.30/#example-79 -# -| <- markup.heading.1.markdown punctuation.definition.heading.begin.markdown - -# # -| <- markup.heading.1.markdown punctuation.definition.heading.begin.markdown -|^^^ meta.block-level.markdown markup.heading.1.markdown - entity.name.section -| ^ punctuation.definition.heading.end.markdown - -## -| <- markup.heading.2.markdown punctuation.definition.heading.begin.markdown - entity.name.section -|^ markup.heading.2.markdown punctuation.definition.heading.begin.markdown - entity.name.section - -## ## -| <- markup.heading.2.markdown punctuation.definition.heading.begin.markdown - entity.name.section -|^^^^^ meta.block-level.markdown markup.heading.2.markdown - entity.name.section -|^ punctuation.definition.heading.begin.markdown -| ^^ punctuation.definition.heading.end.markdown - -### ### -| <- meta.block-level.markdown markup.heading.3.markdown - entity.name.sectionpunctuation.definition.heading.begin.markdown -|^^^^^^^ meta.block-level.markdown markup.heading.3.markdown - entity.name.section -|^^ punctuation.definition.heading.begin.markdown -| ^^^ punctuation.definition.heading.end.markdown - -# #### # -| <- markup.heading.1.markdown punctuation.definition.heading.begin.markdown -|^^^^^^^^ meta.block-level.markdown markup.heading.1.markdown -|^ - entity.name.section -| ^^^^ entity.name.section.markdown -| ^^ - entity.name.section -| ^ punctuation.definition.heading.end.markdown - -## #### ## -| <- markup.heading.2.markdown punctuation.definition.heading.begin.markdown -|^^^^^^^^^^ meta.block-level.markdown markup.heading.2.markdown -|^ - entity.name.section -| ^^^^ entity.name.section.markdown -| ^^^ - entity.name.section -| ^^ punctuation.definition.heading.end.markdown - -#NotAHeading -| <- - markup.heading -|^^^^^^^^^^^^ - markup.heading - -Headings terminate paragraphs -# Heading -| <- markup.heading.1.markdown punctuation.definition.heading.begin.markdown - markup.bold -|^^^^^^^^ markup.heading.1.markdown - -Headings terminate **bold text -# Heading -| <- markup.heading.1.markdown punctuation.definition.heading.begin.markdown - markup.bold -|^^^^^^^^ markup.heading.1.markdown -this must not be bold** -| <- - meta.bold -|^^^^^^^^^^^^^^^^^^^^^^^^ - meta.bold - -Headings terminate *italic text -# Heading -| <- markup.heading.1.markdown punctuation.definition.heading.begin.markdown - markup.italic -|^^^^^^^^ markup.heading.1.markdown -this must not be italic* -| <- - meta.italic -|^^^^^^^^^^^^^^^^^^^^^^^ - meta.italic - -Headings terminate ***bold italic text -# Heading -| <- markup.heading.1.markdown punctuation.definition.heading.begin.markdown - markup.bold - markup.italic -|^^^^^^^^ markup.heading.1.markdown -this must not be bold italic*** -| <- - meta.bold - markup.italic -|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.bold - markup.italic - -SETEXT Heading Level 1 -| <- markup.heading.1.markdown entity.name.section.markdown -================= -| <- markup.heading.1.markdown punctuation.definition.heading.setext.markdown -|^^^^^^^^^^^^^^^^ markup.heading.1.markdown punctuation.definition.heading.setext.markdown -| ^ markup.heading.1.markdown meta.whitespace.newline.markdown - -SETEXT Heading Level 2 -| <- markup.heading.2.markdown entity.name.section.markdown ------------------------------- -| <- markup.heading.2.markdown punctuation.definition.heading.setext.markdown -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.heading.2.markdown punctuation.definition.heading.setext.markdown -| ^ markup.heading.2.markdown meta.whitespace.newline.markdown - punctuation - -underlined heading followed by a separator -------------------- ------- -| <- meta.separator.thematic-break.markdown - markup.heading - -underlined heading followed by another one that should be treated as a normal paragraph -================== -===== -| <- meta.paragraph.markdown - markup.heading - -https://spec.commonmark.org/0.30/#example-80 - -Foo *bar* -| <- markup.heading.1.markdown entity.name.section.markdown -|^^^^^^^^^ markup.heading.1.markdown entity.name.section.markdown -| ^^^^^ markup.italic.markdown -========= -| <- markup.heading.1.markdown punctuation.definition.heading.setext.markdown -|^^^^^^^^ markup.heading.1.markdown punctuation.definition.heading.setext.markdown -| ^ markup.heading.1.markdown meta.whitespace.newline.markdown - -Foo *bar* -| <- markup.heading.2.markdown entity.name.section.markdown -|^^^^^^^^^ markup.heading.2.markdown entity.name.section.markdown -| ^^^^^ markup.italic.markdown ---------- -| <- markup.heading.2.markdown punctuation.definition.heading.setext.markdown -|^^^^^^^^ markup.heading.2.markdown punctuation.definition.heading.setext.markdown -| ^ markup.heading.2.markdown meta.whitespace.newline.markdown - -Foo *bar -| <- markup.heading.1.markdown entity.name.section.markdown -|^^^^^^^^^ markup.heading.1.markdown entity.name.section.markdown -| ^^^^^ markup.italic.markdown -========= -| <- markup.heading.1.markdown punctuation.definition.heading.setext.markdown - markup.italic -|^^^^^^^^ markup.heading.1.markdown punctuation.definition.heading.setext.markdown - markup.italic -| ^ markup.heading.1.markdown meta.whitespace.newline.markdown - markup.italic - -Foo *bar -| <- markup.heading.2.markdown entity.name.section.markdown -|^^^^^^^^^ markup.heading.2.markdown entity.name.section.markdown -| ^^^^^ markup.italic.markdown ---------- -| <- markup.heading.2.markdown punctuation.definition.heading.setext.markdown - markup.italic -|^^^^^^^^ markup.heading.2.markdown punctuation.definition.heading.setext.markdown - markup.italic -| ^ markup.heading.2.markdown meta.whitespace.newline.markdown - markup.italic - -https://spec.commonmark.org/0.30/#example-81 - -Foo *bar -baz* -| <- markup.heading.1.markdown entity.name.section.markdown markup.italic.markdown -|^^^ markup.heading.1.markdown entity.name.section.markdown markup.italic.markdown -| ^ markup.heading.1.markdown entity.name.section.markdown - markup.italic -==== -| <- markup.heading.1.markdown punctuation.definition.heading.setext.markdown -|^^^ markup.heading.1.markdown punctuation.definition.heading.setext.markdown -| ^ markup.heading.1.markdown meta.whitespace.newline.markdown - -https://spec.commonmark.org/0.30/#example-82 - - Foo *bar -baz* -| <- markup.heading.1.markdown entity.name.section.markdown markup.italic.markdown -|^^^ markup.heading.1.markdown entity.name.section.markdown markup.italic.markdown -| ^^ markup.heading.1.markdown entity.name.section.markdown - markup.italic -==== -| <- markup.heading.1.markdown punctuation.definition.heading.setext.markdown -|^^^ markup.heading.1.markdown punctuation.definition.heading.setext.markdown -| ^ markup.heading.1.markdown meta.whitespace.newline.markdown - -https://spec.commonmark.org/0.30/#example-83 - -Foo -= -| <- markup.heading.1.markdown punctuation.definition.heading.setext.markdown -|^ markup.heading.1.markdown meta.whitespace.newline.markdown - -Foo -- -| <- markup.heading.2.markdown punctuation.definition.heading.setext.markdown -|^ markup.heading.2.markdown meta.whitespace.newline.markdown - -https://spec.commonmark.org/0.30/#example-84 - - Foo ---- -| <- markup.heading.2.markdown punctuation.definition.heading.setext.markdown -|^^ markup.heading.2.markdown punctuation.definition.heading.setext.markdown -| ^ markup.heading.2.markdown meta.whitespace.newline.markdown - - Foo ------ -| <- markup.heading.2.markdown punctuation.definition.heading.setext.markdown -|^^^^ markup.heading.2.markdown punctuation.definition.heading.setext.markdown -| ^ markup.heading.2.markdown meta.whitespace.newline.markdown - - Foo - === -| <- markup.heading.1.markdown - punctuation -|^ markup.heading.1.markdown - punctuation -| ^^^ markup.heading.1.markdown punctuation.definition.heading.setext.markdown -| ^ markup.heading.1.markdown meta.whitespace.newline.markdown - -https://spec.commonmark.org/0.30/#example-85 - - Foo - --- -|^^^^^^^ markup.raw.block.markdown - - Foo ---- -| <- meta.separator.thematic-break.markdown - markup.heading -|^^^ meta.separator.thematic-break.markdown - markup.heading - -https://spec.commonmark.org/0.30/#example-86 - -Foo - ---- -|^^^^^^^^^^^^^ markup.heading.2.markdown -|^^ - punctuation -| ^^^^ punctuation.definition.heading.setext.markdown -| ^^^^^^^ - punctuation -| ^ meta.whitespace.newline.markdown - -https://spec.commonmark.org/0.30/#example-87 - -Foo - --- -| <- meta.paragraph.markdown - markup.heading -|^^^^^^^ meta.paragraph.markdown - markup.heading - -https://spec.commonmark.org/0.30/#example-88 - -Foo -= = -| <- meta.paragraph.markdown - markup.heading -|^^^ meta.paragraph.markdown - markup.heading - -Foo ---- - -| <- meta.separator.thematic-break.markdown - markup.heading -|^^^^^ meta.separator.thematic-break.markdown - markup.heading - -https://spec.commonmark.org/0.30/#example-89 - -Foo -| ^^ markup.heading.2.markdown entity.name.section.markdown - meta.hard-line-break ------ -| <- markup.heading.2.markdown punctuation.definition.heading.setext.markdown -|^^^^ markup.heading.2.markdown punctuation.definition.heading.setext.markdown - -https://spec.commonmark.org/0.30/#example-90 - -Foo\ -| ^ markup.heading.2.markdown entity.name.section.markdown - meta.hard-line-break ----- -| <- markup.heading.2.markdown punctuation.definition.heading.setext.markdown -|^^^ markup.heading.2.markdown punctuation.definition.heading.setext.markdown - -https://spec.commonmark.org/0.30/#example-91 - -`Foo ----- -| <- markup.heading.2.markdown punctuation.definition.heading.setext.markdown -|^^^ markup.heading.2.markdown punctuation.definition.heading.setext.markdown - -`Foo` ----- -| <- markup.heading.2.markdown punctuation.definition.heading.setext.markdown -|^^^ markup.heading.2.markdown punctuation.definition.heading.setext.markdown - -https://spec.commonmark.org/0.30/#example-92 - -> Foo ---- -| <- meta.separator.thematic-break.markdown - markup.heading -|^^^ meta.separator.thematic-break.markdown - markup.heading - -https://spec.commonmark.org/0.30/#example-93 - -> foo -bar -=== -| <- markup.quote.markdown - markup.heading -|^^^ markup.quote.markdown - markup.heading - -https://spec.commonmark.org/0.30/#example-94 -- Foo ---- -| <- meta.separator.thematic-break.markdown - markup.heading -|^^^ meta.separator.thematic-break.markdown - markup.heading - -https://spec.commonmark.org/0.30/#example-95 - -Foo -Bar ---- -| <- markup.heading.2.markdown punctuation.definition.heading.setext.markdown -|^^ markup.heading.2.markdown punctuation.definition.heading.setext.markdown - -https://spec.commonmark.org/0.30/#example-96 - ---- -Foo ---- -| <- markup.heading.2.markdown punctuation.definition.heading.setext.markdown -|^^ markup.heading.2.markdown punctuation.definition.heading.setext.markdown - ---- -Foo ---- -Bar ---- -| <- markup.heading.2.markdown punctuation.definition.heading.setext.markdown -|^^ markup.heading.2.markdown punctuation.definition.heading.setext.markdown -Baz - ---- -Foo ---- -Bar ---- -Baz -| <- meta.paragraph.markdown -|^^^ meta.paragraph.markdown - -https://spec.commonmark.org/0.30/#example-97 - -==== -| <- meta.paragraph.markdown -|^^^^ meta.paragraph.markdown - -https://spec.commonmark.org/0.30/#example-98 - ---- ---- -| <- meta.separator.thematic-break.markdown - markup.heading -|^^^ meta.separator.thematic-break.markdown - markup.heading - -https://spec.commonmark.org/0.30/#example-102 - -\> foo ------- -| <- markup.heading.2.markdown punctuation.definition.heading.setext.markdown -|^^^^^ markup.heading.2.markdown punctuation.definition.heading.setext.markdown - -``` -Fenced codeblocks are no no setext heading -``` ---- -| <- meta.separator.thematic-break.markdown punctuation.definition.thematic-break.markdown -|^^ meta.separator.thematic-break.markdown punctuation.definition.thematic-break.markdown - - -Paragraph of text that should be scoped as meta.paragraph. -|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.paragraph -A [link](https://example.com){ :_attr = value }, *italic text* and **bold**. -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.inline -| ^ punctuation.definition.link.begin -| ^ punctuation.definition.link.end -| ^ punctuation.definition.metadata -| ^^^^^^^^^^^^^^^^^^^ markup.underline.link -| ^ punctuation.definition.metadata -| ^ punctuation.definition.attributes.begin.markdown -| ^^^^^^^^^^^^^^ meta.attribute-with-value.markdown -| ^^^^^^ entity.other.attribute-name.markdown -| ^ punctuation.separator.key-value.markdown -| ^^^^^ string.unquoted.markdown -| ^ punctuation.definition.attributes.end.markdown -| ^^^^^^^^^^^^^ markup.italic -| ^ punctuation.definition.italic -| ^ punctuation.definition.italic -| ^^ punctuation.definition.bold -| ^^^^^^^^ markup.bold -| ^^ punctuation.definition.bold - -Inline `code sample`. -| ^^^^^^^^^^^^^ markup.raw.inline -| ^ punctuation.definition.raw -| ^ punctuation.definition.raw - -Here is a [](https://example.com). -| ^^ meta.link.inline -| ^ punctuation.definition.link.begin -| ^ punctuation.definition.link.end -| ^ punctuation.definition.metadata -| ^^^^^^^^^^^^^^^^^^^ markup.underline.link -| ^ punctuation.definition.metadata - -Here is a [](https://example.com){_attr="value"}. -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.inline -| ^ punctuation.definition.link.begin -| ^ punctuation.definition.link.end -| ^ punctuation.definition.metadata -| ^^^^^^^^^^^^^^^^^^^ markup.underline.link -| ^ punctuation.definition.metadata -| ^ punctuation.definition.attributes.begin.markdown -| ^^^^^^^^^^^^^ meta.attribute-with-value.markdown -| ^^^^^ entity.other.attribute-name.markdown -| ^ punctuation.separator.key-value.markdown -| ^^^^^^^ string.quoted.double.markdown -| ^ punctuation.definition.attributes.end.markdown - -Here is a [reference link][name]. -| ^^^^^^^^^^^^^^^^^^^^^^ meta.link.reference -| ^ punctuation.definition.constant.begin -| ^^^^ constant.other.reference.link -| ^ punctuation.definition.constant.end - -Here is a [reference link][name]{_attr='value' :att2}. -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.reference -| ^ punctuation.definition.constant.begin -| ^^^^ constant.other.reference.link -| ^ punctuation.definition.constant.end -| ^ punctuation.definition.attributes.begin.markdown -| ^^^^^ entity.other.attribute-name.markdown -| ^ punctuation.separator.key-value.markdown -| ^^^^^^^ string.quoted.single.markdown -| ^^^^^ entity.other.attribute-name.markdown -| ^ punctuation.definition.attributes.end.markdown - -Here is a [blank reference link][]{}. -| ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.reference -| ^ punctuation.definition.constant.begin -| ^ punctuation.definition.constant.end -| ^ punctuation.definition.attributes.begin.markdown -| ^ punctuation.definition.attributes.end.markdown - -Here is a footnote[^1][link][] or long[^longnote][link][]. -| ^^^^ meta.link.reference.footnote.markdown-extra -| ^^^^^^^^ meta.link.reference.literal -| ^^^^^^^^^^^ meta.link.reference.footnote.markdown-extra -| ^^^^^^^^ meta.link.reference.literal - -Here is a ![](https://example.com/cat.gif). -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.image.inline -| ^ punctuation.definition.image.begin -| ^ punctuation.definition.image.end - string -| ^ punctuation.definition.metadata -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.image -| ^ punctuation.definition.metadata - -Here is a ![](https://example.com/cat.gif){_at"r=value :att2}. -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.image.inline -| ^ punctuation.definition.image.begin -| ^ punctuation.definition.image.end - string -| ^ punctuation.definition.metadata -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.image -| ^ punctuation.definition.metadata -| ^ punctuation.definition.attributes.begin.markdown -| ^^^^^ entity.other.attribute-name.markdown -| ^ invalid.illegal.attribute-name.markdown -| ^ punctuation.separator.key-value.markdown -| ^^^^^ string.unquoted.markdown -| ^^^^^ entity.other.attribute-name.markdown -| ^ punctuation.definition.attributes.end.markdown - -Here is a ![Image Alt Text](https://example.com/cat.gif). -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.image.inline -| ^ punctuation.definition.image.begin -| ^ punctuation.definition.image.end - string -| ^ punctuation.definition.metadata -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.image -| ^ punctuation.definition.metadata - -Here is a ![Image Alt Text]( https://example.com/cat.gif ). -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.image.inline -| ^ punctuation.definition.image.begin -| ^ punctuation.definition.image.end - string -| ^ punctuation.definition.metadata -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.image -| ^ punctuation.definition.metadata - -Here is a ![Image Alt Text]( - https://example.com/cat.gif ). -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.image -| ^ punctuation.definition.metadata - -Here is a ![Image Alt Text]( - https://example.com/cat.gif - "hello" ). -|^^^^^^^ meta.image.inline string.other.link.description.title -| ^^^^ meta.image.inline -| ^ punctuation.definition.metadata.end - -Here is a ![Image Alt Text]( - "hello" ). -| ^ punctuation.definition.link.begin -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.image -| ^ punctuation.definition.link.end -| ^^^^^^^ string.other.link.description.title -|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.paragraph meta.image.inline -| ^ punctuation.definition.metadata.end - -Here is a ![Image Alt Text]( - (hello) ). -| ^ punctuation.definition.link.begin -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.image -| ^ invalid.illegal.unexpected-whitespace -| ^ invalid.illegal.unexpected-whitespace -| ^ punctuation.definition.link.end -| ^^^^^^^ string.other.link.description.title -|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.paragraph meta.image.inline -| ^ punctuation.definition.metadata.end - -Here is a ![Image Alt Text]( - https://example .com /cat.gif (hello) ). -| ^^^^^^^^^^^^^^^ markup.underline.link.image -| ^ invalid.illegal.unexpected-whitespace -| ^^^^ markup.underline.link.image -| ^ invalid.illegal.unexpected-whitespace -| ^^^^^^^^ markup.underline.link.image -| ^^^^^^^ string.other.link.description.title -|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.paragraph meta.image.inline -| ^ punctuation.definition.metadata.end - -Here is a ![Image Ref Alt][1]. -| ^^^^^^^^^^^^^^^^^^^ meta.image.reference -| ^^ punctuation.definition.image.begin -| ^ punctuation.definition.image.end -| ^ punctuation.definition.constant -| ^ constant.other.reference.link -| ^ punctuation.definition.constant - -now you can access the [The Ever Cool Site: Documentation about Sites]( - www.thecoolsite.com.ca/documentations/about/cool ) for more information about... -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.inline markup.underline.link -| ^ - invalid -| ^ meta.link.inline punctuation.definition.metadata.end - -now you can access the [The Ever Cool Site: Documentation about Sites]( - www.thecoolsite.com.ca /documentations/about/cool ) for more information about... -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.paragraph meta.link.inline -| ^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link -| ^ invalid.illegal.unexpected-whitespace -| ^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link -| ^ - invalid -| ^ punctuation.definition.metadata.end - -now you can access the [The Ever Cool Site: Documentation about Sites]( - www.thecoolsite.com.ca/documentations/about/cool - (title)) for more information about... -| ^^^^^^^^ meta.paragraph meta.link.inline -| ^ punctuation.definition.metadata.end -| ^^^^^^^ string.other.link.description.title.markdown - - 1. Ordered list item -| ^^^^^^^^^^^^^^^^^^^^^ markup.list.numbered -| ^^ markup.list.numbered.bullet - markup.list.numbered markup.list.numbered -| ^ punctuation.definition.list_item - 2. Ordered list item #2 -| ^^^^^^^^^^^^^^^^^^^^^^^^ markup.list.numbered - markup.list.numbered markup.list.numbered -| ^^ markup.list.numbered.bullet -| ^ punctuation.definition.list_item - 1. Subitem - 2. Another subitem -|^^^^^^^^^^^^^^^^^^^^^^^ markup.list.numbered -| ^^ markup.list.numbered.bullet -| ^ punctuation.definition.list_item -| ^^^^^^^^^^^^^^^^ meta.paragraph.list - meta.paragraph.list meta.paragraph.list - -Paragraph break. - - - Unordered list item -| ^^^^^^^^^^^^^^^^^^^^ markup.list.unnumbered - markup.list.unnumbered markup.list.unnumbered -| ^ markup.list.unnumbered.bullet punctuation.definition.list_item - - Unordered list item #2 -| ^^^^^^^^^^^^^^^^^^^^^^^ markup.list.unnumbered - markup.list.unnumbered markup.list.unnumbered -| ^ markup.list.unnumbered.bullet punctuation.definition.list_item - -Paragraph break. - -- `` | `` (components/Logo.vue) -- `` | `` | (components/my-component.vue) -| <- markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.list.unnumbered.markdown meta.paragraph.list.markdown - -Paragraph break. - - * Unordered list item -| ^^^^^^^^^^^^^^^^^^^^ markup.list.unnumbered - markup.list.unnumbered markup.list.unnumbered -| ^ markup.list.unnumbered.bullet punctuation.definition.list_item - + Unordered list item #2 -| ^^^^^^^^^^^^^^^^^^^^^^ markup.list.unnumbered - markup.list.unnumbered markup.list.unnumbered -| ^ markup.list.unnumbered.bullet punctuation.definition.list_item - + Subitem 1 -| ^ punctuation.definition.list_item - + Item - + Subitem - + Another subitem -| ^ markup.list.unnumbered.bullet punctuation.definition.list_item - meta.paragraph.list -| ^^^^^^^^^^^^^^^ meta.paragraph.list - + Nested Subitem -| ^ markup.list.unnumbered.bullet punctuation.definition.list_item - markup.list.unnumbered markup.list.unnumbered - + Nested + Subitem -| ^ markup.list.unnumbered.bullet punctuation.definition.list_item -| ^ - punctuation.definition.list_item - - * Unsorted list item - ```xml -|^^^ markup.list.unnumbered.markdown meta.paragraph.list.markdown meta.code-fence.definition.begin.xml.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown -| ^^ markup.list.unnumbered.markdown meta.paragraph.list.markdown meta.code-fence.definition.begin.xml.markdown-gfm constant.other.language-name.markdown - -|^^^^^ markup.list.unnumbered.markdown meta.paragraph.list.markdown markup.raw.code-fence.xml.markdown-gfm text.xml meta.tag.xml - ``` -|^^^ markup.list.unnumbered.markdown meta.paragraph.list.markdown meta.code-fence.definition.end.xml.markdown-gfm punctuation.definition.raw.code-fence.end.markdown - -Paragraph break. - -> This is a block quote. It contains markup. -> Including things like *italics* -|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.quote -| ^^^^^^^^^ markup.italic - -Paragraph break. - ---- -|^^^ meta.block-level meta.separator.thematic-break -|^^ punctuation.definition.thematic-break - -Paragraph break. - --------- -|^^^^^^^^ meta.block-level meta.separator.thematic-break -|^^^^^^^ punctuation.definition.thematic-break - -[1]: https://google.com -| <- meta.link.reference.def -|^^^^^^^^^^^^^^^^^^^^^^ meta.link.reference.def -|^ entity.name.reference.link -| ^ punctuation.separator.key-value -| ^^^^^^^^^^^^^^^^^^ markup.underline.link - -
this is HTML until there are two blank lines
-| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.disable-markdown -disabled markdown -| <- meta.disable-markdown - -non-disabled markdown -| <- - meta.disable-markdown - -
this is HTML until there are two blank lines -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.disable-markdown -still HTML -| ^^^^ meta.tag.inline.any.html entity.name.tag.inline.any.html -
-| ^^^^ meta.disable-markdown - -non-disabled markdown -| <- - meta.disable-markdown - -
nested tags don't count 
test
-| ^^^^^^ meta.disable-markdown meta.tag.block.any.html -non-disabled markdown -| <- - meta.disable-markdown - -
nested tags don't count
test -| ^^^^^ meta.disable-markdown -
-| ^^^ meta.disable-markdown entity.name.tag.block.any.html - -non-disabled markdown -| <- - meta.disable-markdown - -
two blank lines needed
to stop disabled markdown -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.disable-markdown -disabled markdown -| <- meta.disable-markdown - -non-disabled markdown -| <- - meta.disable-markdown - -
another
disable test -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.disable-markdown -| ^^^^^^ meta.tag.inline.any.html -disabled markdown -| <- meta.disable-markdown - -non-disabled markdown -| <- - meta.disable-markdown - -*a* -| ^ markup.italic -

*a*

-| ^^^^^^^^^ meta.disable-markdown - markup.italic -*a* -| ^^ meta.disable-markdown - -non-disabled markdown -| <- - meta.disable-markdown - - -# Block Quote Tests ########################################################### - ->= -| <- punctuation.definition.blockquote.markdown - ->== -| <- punctuation.definition.blockquote.markdown - - >= -| ^ punctuation.definition.blockquote.markdown - >= -| ^^ - punctuation.definition.blockquote.markdown - - >= -| ^^ - punctuation.definition.blockquote.markdown - -> Block quote -| <- meta.block-level markup.quote punctuation.definition.blockquote -| ^^^^^^^^^^^ meta.block-level markup.quote - -> Block quote followed by an empty block quote line -> -| <- meta.block-level markup.quote punctuation.definition.blockquote - -> Block quote followed by an empty block quote line -> -> Followed by more quoted text -| <- meta.block-level markup.quote punctuation.definition.blockquote - -> > Nested block quote -| <- meta.block-level markup.quote punctuation.definition.blockquote -| ^^^^^^^^^^^^^^^^^^^^^ meta.block-level.markdown markup.quote.markdown markup.quote.markdown -|^ - punctuation -| ^ punctuation.definition.blockquote -| ^ - punctuation - -> > Nested quote -> Followed by more quoted text that is not nested -| <- meta.block-level markup.quote punctuation.definition.blockquote - markup.quote markup.quote - -> Here is a block quote -This quote continues on. Line breaking is OK in markdown -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block-level markup.quote -> Here it is again -| <- punctuation.definition.blockquote - -paragraph -| <- meta.paragraph - meta.block-level - -> > this is a nested quote but no code in a block quote -| <- punctuation.definition.blockquote -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block-level.markdown markup.quote.markdown markup.quote.markdown - -> > this is code in a block quote, not a nested quote -| <- punctuation.definition.blockquote -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.raw.block - markup.quote markup.quote - -> CommonMark expects following line to be indented code block (see: example 326) - > but all common parsers handle it as continued text. -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block-level.markdown markup.quote.markdown - markup.raw -| ^ - punctuation - -> Quoted fenced code block begin -> ``` -| <- meta.block-level.markdown markup.quote.markdown punctuation.definition.blockquote.markdown -|^ meta.block-level.markdown markup.quote.markdown - meta.code-fence -| ^^^^ meta.block-level.markdown markup.quote.markdown meta.code-fence.definition.begin.text.markdown-gfm -| ^^^ punctuation.definition.raw.code-fence.begin.markdown - -> Quoted fenced code block language identifier -> ```C++ -| <- meta.block-level.markdown markup.quote.markdown punctuation.definition.blockquote.markdown -|^ meta.block-level.markdown markup.quote.markdown - meta.code-fence -| ^^^^^^^ meta.block-level.markdown markup.quote.markdown meta.code-fence.definition.begin.text.markdown-gfm -| ^^^ constant.other.language-name.markdown - -> Quoted fenced code block language identifier -> ```C++ info string -| <- meta.block-level.markdown markup.quote.markdown punctuation.definition.blockquote.markdown -|^ meta.block-level.markdown markup.quote.markdown - meta.code-fence -| ^^^^^^^^^^^^^^^^^^^ meta.block-level.markdown markup.quote.markdown meta.code-fence.definition.begin.text.markdown-gfm -| ^^^ constant.other.language-name.markdown -| ^^^^^^^^^^^^^ - constant - -> Quoted fenced code block content -> ``` -> code block -| <- meta.block-level.markdown markup.quote.markdown punctuation.definition.blockquote.markdown -|^ meta.block-level.markdown markup.quote.markdown - meta.code-fence -| ^^^^^^^^^^^ meta.block-level.markdown markup.quote.markdown markup.raw.code-fence.markdown-gfm - -> Quoted fenced code block end -> ``` -> ``` -| <- meta.block-level.markdown markup.quote.markdown punctuation.definition.blockquote.markdown -|^ meta.block-level.markdown markup.quote.markdown - meta.code-fence -| ^^^^ meta.block-level.markdown markup.quote.markdown meta.code-fence.definition.end.text.markdown-gfm -| ^^^ punctuation.definition.raw.code-fence.end.markdown - -> > 2nd level quoted fenced code block -> > ``` -> > code block ``` -> > ``` -| <- meta.block-level.markdown markup.quote.markdown markup.quote.markdown punctuation.definition.blockquote.markdown -|^^^ meta.block-level.markdown markup.quote.markdown markup.quote.markdown - meta.code-fence -| ^^^^ meta.block-level.markdown markup.quote.markdown markup.quote.markdown meta.code-fence.definition.end.text.markdown-gfm - -> Block quote followed by fenced code block -``` -| <- meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown - meta.quote -``` -| <- meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown - meta.quote - -> Quoted fenced code block is terminated by missing > at bol -> ``` -no code block -| <- meta.paragraph.markdown - meta.quote - meta.code-fence -|^^^^^^^^^^^^^ meta.paragraph.markdown - meta.quote - meta.code-fence - -> Quoted fenced code block is terminated by missing > at bol -> ``` -> content -no code block -| <- meta.paragraph.markdown - meta.quote - meta.code-fence -|^^^^^^^^^^^^^ meta.paragraph.markdown - meta.quote - meta.code-fence - -> Unterminated quoted fenced code block followed by unquoted fenced code block -> ``` -``` -| <- meta.code-fence.definition.begin.text.markdown-gfm - markup.quote -``` -| <- meta.code-fence.definition.end.text.markdown-gfm - markup.quote - -> Block quote followed by heading -# heading -| <- meta.block-level.markdown markup.heading.1.markdown punctuation.definition.heading.begin.markdown -|^^^^^^^^^ meta.block-level.markdown markup.heading.1.markdown - meta.quote -| ^^^^^^^ entity.name.section.markdown - -> Block quote followed by list -* list item -| <- markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown -|^^^^^^^^^^^ markup.list.unnumbered.markdown - meta.quote - -> Block quote followed by list -+ list item -| <- markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown -|^^^^^^^^^^^ markup.list.unnumbered.markdown - meta.quote - -> Block quote followed by list -- list item -| <- markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown -|^^^^^^^^^^^ markup.list.unnumbered.markdown - meta.quote - -> Block quote followed by list -1. list item -| <- markup.list.numbered.bullet.markdown - punctuation -|^ markup.list.numbered.bullet.markdown punctuation.definition.list_item.markdown -| ^^^^^^^^^^ markup.list.numbered.markdown - meta.quote - -> Block quote followed by thematic break -*** -| <- meta.block-level.markdown meta.separator.thematic-break.markdown punctuation.definition.thematic-break.markdown - meta.quote - -> Block quote followed by thematic break -- - - -| <- meta.block-level.markdown meta.separator.thematic-break.markdown punctuation.definition.thematic-break.markdown - meta.quote - -Code block below: - - this is code! -| ^^^^^^^^^^^^^^^^ meta.block-level markup.raw.block - - more code - spanning multiple lines -| ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block-level markup.raw.block - -paragraph -| <- meta.paragraph - meta.block-level - -- - - - -| ^^^^^^ meta.block-level meta.separator -| ^ punctuation.definition.thematic-break -| ^ punctuation.definition.thematic-break -| ^ punctuation.definition.thematic-break -| ^ - punctuation -* * * * * -| ^^^^^^^^ meta.block-level meta.separator - -_ _ _ _ _ _ _ -| ^^^^^^^^^^^^ meta.block-level meta.separator -| ^ punctuation.definition.thematic-break -| ^ punctuation.definition.thematic-break -| ^ - punctuation - -- - - - -| <- meta.block-level meta.separator.thematic-break punctuation.definition.thematic-break -|^^ - punctuation -| ^ punctuation -| ^ punctuation - - -| ^^^^^^^^^^^^^^^^^^^^^^^^ meta.paragraph meta.link.email.lt-gt markup.underline.link - -| ^^^^^^^^^^^^^^^^^^^ meta.paragraph meta.link.inet markup.underline.link - -| ^^^^^^^^^^^^^^^^ meta.paragraph meta.link.inet markup.underline.link - -| ^^^^^^^^^^^^^^ meta.paragraph meta.link.inet markup.underline.link - -Visit www.commonmark.org/help for more information. -| ^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link -| ^^^^^^^^^^^^^^^^^^^^^^^ - markup.underline.link -Visit www.commonmark.org. -| ^^^^^^^^^^^^^^^^^^ meta.paragraph markup.underline.link -| ^^ - markup.underline.link -Visit www.commonmark.org/a.b. -| ^^^^^^^^^^^^^^^^^^^^^^ meta.paragraph markup.underline.link -| ^ - markup.underline.link -www.google.com/search?q=(business))+ok -|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link -| ^ - markup.underline.link -www.google.com/search?q=Markup+(business) -|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link -www.commonmark.org/he -|^^^^^^^^^^^^^^^^^^^^ markup.underline.link -| ^ - markup.underline.link -http://commonmark.org -|^^^^^^^^^^^^^^^^^^^^ markup.underline.link -www.google.com/search?q=commonmark&hl=en -|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link -| ^ - markup.underline.link -www.google.com/search?q=commonmark&hl; -|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link -| ^^^^ constant.character.entity.named.html - markup.underline.link -(Visit https://encrypted.google.com/search?q=Markup+(business)) -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link -| ^^ - markup.underline.link -Anonymous FTP is available at ftp://foo.bar.baz. -| ^^^^^^^^^^^^^^^^^ markup.underline.link -| ^^ - markup.underline.link -(see http://www.google.com/search?q=commonmark&hl=en) -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link -| ^^ - markup.underline.link - -foo@bar.baz -|^^^^^^^^^^ markup.underline.link -hello@mail+xyz.example isn't valid, but hello+xyz@mail.example is. -|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - markup.underline.link -| ^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link - a.b-c_d@a.b -|^^^^^^^^^^^ markup.underline.link -| ^ - markup.underline.link -a.b-c_d@a.b. -|^^^^^^^^^^ markup.underline.link -| ^^ - markup.underline.link - a.b-c_d@a.b- -|^^^^^^^^^^^^^ - markup.underline.link - a.b-c_d@a.b_ -|^^^^^^^^^^^^^ - markup.underline.link - test@test.test.me -|^^^^^^^^^^^^^^^^^ markup.underline.link - -this is a raw ampersand & does not require HTML escaping -| ^ meta.other.valid-ampersand - -this is a raw bracket < > does not require HTML escaping -| ^^^ - meta.tag -| ^ meta.other.valid-bracket -| ^ - meta.other.valid-bracket - -these are raw ligatures << <<< <<<< <<<<< >>>>> >>>> >>> >> -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.other.valid-bracket - meta.tag - -these are raw ligatures <- <-- <--- <---- <-< <--< <---< <----< -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.other.valid-bracket - meta.tag - -these are raw ligatures -> --> ---> ----> >-> >--> >---> >----> -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.other.valid-bracket - meta.tag - -these are raw ligatures >- >-- >--- >---- ----< ---< --< -< -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.other.valid-bracket - meta.tag - -these are raw ligatures >< >-< >--< >---< <---> <--> <-> <> -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.other.valid-bracket - meta.tag - -these are raw ligatures <= <== <=== <==== <=< <==< <===< <====< -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.other.valid-bracket - meta.tag - -these are raw ligatures => ==> ===> ====> >=> >==> >===> >====> -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.other.valid-bracket - meta.tag - -these are raw ligatures >= >== >=== >==== ====< ===< ==< =< -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.other.valid-bracket - meta.tag - -these are raw ligatures >< >=< >==< >===< <===> <==> <=> <> -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.other.valid-bracket - meta.tag - -these are raw ligatures - -- --- ---- ----- ===== ==== === == = -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.other.valid-bracket - meta.tag - -[2]: https://github.com/sublimehq/Packages "Packages Repo" -| <- meta.link.reference.def -|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.reference.def -|^ entity.name.reference.link -| ^ punctuation.separator.key-value -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link -| ^^^^^^^^^^^^^^^ string.other.link.description.title -| ^ punctuation.definition.string.begin -| ^ punctuation.definition.string.end - -[3]: https://github.com/sublimehq/Packages/issues/ 'Issues on Packages Repo' -| <- meta.link.reference.def -|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.reference.def -|^ entity.name.reference.link -| ^ punctuation.separator.key-value -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link -| ^^^^^^^^^^^^^^^^^^^^^^^^^ string.other.link.description.title -| ^ punctuation.definition.string.begin -| ^ punctuation.definition.string.end - -Paragraph followed immediately by a list, no blank line in between -- list item 1 -| <- markup.list.unnumbered punctuation.definition.list_item - -Paragraph followed immediately by a numbered list, no blank line in between - 1. list item 1 -|^^^^^^^^^^^^^^^ markup.list.numbered -|^^ markup.list.numbered.bullet -| ^ punctuation.definition.list_item -| ^^^^^^^^^^^^ meta.paragraph.list - more text - this punctuation should be ignored 2. -|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.list.numbered meta.paragraph.list -| ^ - punctuation.definition.list_item -| ^ - punctuation.definition.list_item - -Paragraph not followed immediately by a numbered list, -because it doesn't begin with the number one: - 2. text -| ^ - markup.list.numbered - punctuation.definition.list_item - - -> Block quote with list items -> - list item 1 -| ^ meta.block-level markup.quote punctuation.definition.list_item -> - list item 2 -| ^ markup.list.unnumbered.bullet punctuation.definition.list_item -| ^^^^^^^^^^^^^^ meta.block-level markup.quote markup.list.unnumbered -| ^^^^^^^^^^^^ meta.paragraph.list -> 1. sub list item -| <- meta.block-level markup.quote punctuation.definition.blockquote -|^^^^^^^^^^^^^^^^^^^^ meta.block-level markup.quote -| ^ punctuation.definition.list_item -| ^^ markup.list.numbered.bullet -| ^^^^^^^^^^^^^^^^^^^ markup.list.numbered -| ^^^^^^^^^^^^^^ meta.paragraph.list - -* this is a list - - > This is a blockquote. -| ^ markup.list.unnumbered markup.quote punctuation.definition.blockquote - - This is a paragraph still part of the - list item -| ^^^^^^^^^ markup.list.unnumbered meta.paragraph.list - meta.paragraph.list meta.paragraph.list - -* Lorem ipsum - - This is a code block -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.list.unnumbered markup.raw.block -* list continues -| <- markup.list.unnumbered punctuation.definition.list_item - markup.raw.block -* list continues -* [ ] Unticked GitHub-flavored-markdown checkbox -|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.list.unnumbered -| ^^^ constant.language.checkbox -* [x] Ticked GFM checkbox -| ^^^ constant.language.checkbox -* [X] Another ticked checkbox -| ^^^ constant.language.checkbox - + [ ] Sub-item with checkbox -| ^^^ constant.language.checkbox -* [] Not a checkbox -| ^^^^^^^^^^^^^^^^^ - storage - constant -* [/] Not a checkbox -| ^^^^^^^^^^^^^^^^^^ - storage -* Not [ ] a [x] checkbox [X] -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - storage - constant -* [ ] [Checkbox][] with next word linked -| ^^^ constant.language.checkbox -| ^^^^^^^^^^^^ meta.link -* list has `unclosed code -* list continues -| ^^^^^^^^^^^^^^^ - markup.raw - -> * [ ] task -| ^^^^^^^^^^^ meta.block-level.markdown markup.quote.markdown -| ^ markup.list.unnumbered.bullet.markdown -| ^^^^^^^^^^ markup.list.unnumbered.markdown -| ^ punctuation.definition.list_item.markdown -| ^^^ constant.language.checkbox.markdown-gfm -> * [x] task -| ^^^^^^^^^^^ meta.block-level.markdown markup.quote.markdown -| ^ markup.list.unnumbered.bullet.markdown -| ^^^^^^^^^^ markup.list.unnumbered.markdown -| ^ punctuation.definition.list_item.markdown -| ^^^ constant.language.checkbox.markdown-gfm -> * [X] task -| ^^^^^^^^^^^ meta.block-level.markdown markup.quote.markdown -| ^ markup.list.unnumbered.bullet.markdown -| ^^^^^^^^^^ markup.list.unnumbered.markdown -| ^ punctuation.definition.list_item.markdown -| ^^^ constant.language.checkbox.markdown-gfm -> * [X] task -> - [ ] task -| ^^^^^^^^^^^^^ meta.block-level.markdown markup.quote.markdown -| ^ markup.list.unnumbered.bullet.markdown -| ^^^^^^^^^^ markup.list.unnumbered.markdown -| ^ punctuation.definition.list_item.markdown -| ^^^ constant.language.checkbox.markdown-gfm - -- `code` - -| ^ markup.list.unnumbered meta.paragraph.list markup.raw.inline punctuation.definition.raw -| ^^^^^^^^^^^^^^^^^^^ meta.tag.inline.a.html - 3. [see `demo`](#demo "demo") -| ^ punctuation.definition.list_item -| ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.inline -| ^^^^^^^^^^ meta.link.inline.description -| ^ punctuation.definition.metadata.begin -| ^ punctuation.definition.string.begin -| ^ punctuation.definition.string.end -| ^ punctuation.definition.metadata.end - [see `demo`](#demo (demo)) -| ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.inline -| ^^^^^^^^^^ meta.link.inline.description -| ^ punctuation.definition.metadata.begin -| ^ punctuation.definition.string.begin -| ^ punctuation.definition.string.end -| ^ punctuation.definition.metadata.end - [see `demo`](#demo 'demo') -| ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.inline -| ^^^^^^^^^^ meta.link.inline.description -| ^ punctuation.definition.metadata.begin -| ^ punctuation.definition.string.begin -| ^ punctuation.definition.string.end -| ^ punctuation.definition.metadata.end - Here is a ![example image](https://test.com/sublime.png "A demonstration"). -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.list.unnumbered meta.paragraph.list meta.image.inline -| ^^ punctuation.definition.image.begin -| ^^^^^^^^^^^^^ meta.image.inline.description -| ^ punctuation.definition.image.end -| ^ punctuation.definition.metadata -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.image -| ^^^^^^^^^^^^^^^^^ string.other.link.description.title -| ^ punctuation.definition.string.begin -| ^ punctuation.definition.string.end -| ^ punctuation.definition.metadata - Here is a ![example image](https://test.com/sublime.png 'A demonstration'). -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.list.unnumbered meta.paragraph.list meta.image.inline -| ^^ punctuation.definition.image.begin -| ^^^^^^^^^^^^^ meta.image.inline.description -| ^ punctuation.definition.image.end -| ^ punctuation.definition.metadata -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.image -| ^^^^^^^^^^^^^^^^^ string.other.link.description.title -| ^ punctuation.definition.string.begin -| ^ punctuation.definition.string.end -| ^ punctuation.definition.metadata - Here is a ![example image](https://test.com/sublime.png (A demonstration)). -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.list.unnumbered meta.paragraph.list meta.image.inline -| ^^ punctuation.definition.image.begin -| ^^^^^^^^^^^^^ meta.image.inline.description -| ^ punctuation.definition.image.end -| ^ punctuation.definition.metadata -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.image -| ^^^^^^^^^^^^^^^^^ string.other.link.description.title -| ^ punctuation.definition.string.begin -| ^ punctuation.definition.string.end -| ^ punctuation.definition.metadata - -1) numberd item -| <- markup.list.numbered.bullet.markdown -|^ markup.list.numbered.bullet.markdown punctuation.definition.list_item.markdown -| ^^^^^^^^^^^^^^ markup.list.numbered.markdown - - 2) numberd item -| <- markup.list.numbered.markdown -|^^ markup.list.numbered.bullet.markdown -| ^^^^^^^^^^^^^^ markup.list.numbered.markdown - - 3) numberd item -| <- markup.list.numbered.markdown -|^ markup.list.numbered.markdown -| ^^ markup.list.numbered.bullet.markdown -| ^^^^^^^^^^^^^^ markup.list.numbered.markdown - - 4) numberd item -| <- markup.list.numbered.markdown -|^^ markup.list.numbered.markdown -| ^^ markup.list.numbered.bullet.markdown -| ^^^^^^^^^^^^^^ markup.list.numbered.markdown - - -| ^^^^^^^^^^^^^^^^^^^^^ comment.block.html - -*italic text HTML element end of italic text* -| <- punctuation.definition.italic -| ^ punctuation.definition.italic -| ^^^^^^ meta.tag.inline.any.html -| ^^^^^^^ meta.tag.inline.any.html - -_italic text HTML element end of italic text_ -| <- punctuation.definition.italic -| ^ punctuation.definition.italic -| ^^^^^^ meta.tag.inline.any.html -| ^^^^^^^ meta.tag.inline.any.html - -**bold text HTML element end of bold text** -| <- punctuation.definition.bold -| ^^ punctuation.definition.bold -| ^^^^^^ meta.tag.inline.any.html -| ^^^^^^^ meta.tag.inline.any.html - -__bold text HTML element end of bold text__ -| <- punctuation.definition.bold -| ^^ punctuation.definition.bold -| ^^^^^^ meta.tag.inline.any.html -| ^^^^^^^ meta.tag.inline.any.html - -*italic text HTML element end of italic text* -| <- punctuation.definition.italic -| ^ punctuation.definition.italic -| ^^^^^^ meta.tag.inline.any.html -| ^^^^^^^ meta.tag.inline.any.html - -_italic text HTML element end of italic text_ -| <- punctuation.definition.italic -| ^ punctuation.definition.italic -| ^^^^^^ meta.tag.inline.any.html -| ^^^^^^^ meta.tag.inline.any.html - -[link [containing] [square] brackets](#backticks) -|<- punctuation.definition.link.begin -|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.inline.description -| ^ punctuation.definition.link.end -[link `containing square] brackets] in backticks`[]](#wow) -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.inline.description -| ^ punctuation.definition.raw.begin -| ^ punctuation.definition.raw.end -| ^ punctuation.definition.link.end -[link ``containing square]` brackets[[][] in backticks``](#wow) -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.inline.description -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.raw.inline -| ^^ punctuation.definition.raw.begin -| ^^ punctuation.definition.raw.end -| ^ punctuation.definition.link.end -`inline markup ` -| ^^^^^^^^^^^^^ markup.raw.inline - meta.tag.inline.any.html -escaped backtick \`this is not code\` -| ^^ constant.character.escape -| ^^ constant.character.escape -| ^^^^^^^^^^^^^^^^ - markup.raw.inline - -This is a [reference] () -| ^^^^^^^^^^^ meta.link.reference -| ^^^^ - meta.link - -This is a [reference] (followed by parens) -| ^^^^^^^^^^^ meta.link.reference -| ^^^^^^^^^^^^^^^^^^^^^ - meta.link - -This is a [reference] [] -| ^^^^^^^^^^^ meta.link.reference -| ^ - meta.link -| ^^ meta.link.reference - -This is a ![reference] () -| ^^^^^^^^^^^^^^^ - meta.image -| ^^^^^^^^^^^ meta.link.reference -| ^^^^ - meta.link - -This is a ![reference] (followed by parens) -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.image -| ^^^^^^^^^^^ meta.link.reference -| ^^^^^^^^^^^^^^^^^^^^^ - meta.link - -This is a ![reference] [] -| ^^^^^^^^^^^^^^^ - meta.image -| ^^^^^^^^^^^ meta.link.reference -| ^ - meta.link -| ^^ meta.link.reference - -http://spec.commonmark.org/0.28/#example-322 -*foo`*` -|^^^^^^^ markup.italic -| ^^^ markup.raw.inline - -| <- invalid.illegal.non-terminated.bold-italic - -http://spec.commonmark.org/0.28/#example-323 -[not a `link](/foo`) -|^^^^^^^^^^^^^^^^^^^ - meta.link -| ^^^^^^^^^^^^ markup.raw.inline - -http://spec.commonmark.org/0.28/#example-324 -`` -|^^^^^^^^^^ markup.raw.inline -| ^^ - markup.raw - -| <- invalid.illegal.non-terminated.raw - -http://spec.commonmark.org/0.28/#example-325 -` -| ^^^^^^^^^ meta.tag.inline.a -| ^ punctuation.definition.raw.begin - -| <- invalid.illegal.non-terminated.raw - -http://spec.commonmark.org/0.28/#example-326 -`` -|^^^^^^^^^^^^^^^^^ markup.raw.inline -| ^ punctuation.definition.raw.begin - -| <- invalid.illegal.non-terminated.raw - -http://spec.commonmark.org/0.28/#example-327 -` -|^^^^^^^^^^^^^^^^^^^ markup.underline.link -| ^ punctuation.definition.raw.begin - -| <- invalid.illegal.non-terminated.raw - -http://spec.commonmark.org/0.27/#example-328 -*foo bar* -| <- punctuation.definition.italic.begin -| ^ punctuation.definition.italic.end - -http://spec.commonmark.org/0.27/#example-329 -This is not emphasis, because the opening `*` is followed by whitespace, and hence not part of a left-flanking delimiter run: -a * foo bar* -| ^^^^^^^^^^^ - punctuation - -http://spec.commonmark.org/0.27/#example-332 -Intraword emphasis with `*` is permitted: -foo*bar* -| ^ punctuation.definition.italic.begin -| ^ punctuation.definition.italic.end -http://spec.commonmark.org/0.27/#example-333 -5*6*78 -|^ punctuation.definition.italic.begin -| ^ punctuation.definition.italic.end - -http://spec.commonmark.org/0.27/#example-334 -_foo bar_ -| <- punctuation.definition.italic.begin -| ^ punctuation.definition.italic.end - -http://spec.commonmark.org/0.27/#example-335 -This is not emphasis, because the opening `_` is followed by whitespace: -_ foo bar_ -| <- - punctuation -| ^^^^^^^^^ - punctuation - -http://spec.commonmark.org/0.27/#example-336 -This is not emphasis, because the opening `_` is preceded by an alphanumeric and followed by punctuation: -a_"foo"_ -|^^^^^^^^ - punctuation - -http://spec.commonmark.org/0.27/#example-337 -Emphasis with `_` is not allowed inside words: -foo_bar_ -| ^^^^^ - punctuation - -http://spec.commonmark.org/0.27/#example-338 -5_6_78 -|^^^^^ - punctuation - -http://spec.commonmark.org/0.27/#example-339 -пристаням_стремятся_ -| ^^^^^^^^^^^ - punctuation - -http://spec.commonmark.org/0.27/#example-341 -foo-_(bar)_ -| ^ punctuation.definition.italic.begin -| ^ punctuation.definition.italic.end - -*foo bar * -| <- punctuation.definition.italic.begin -| ^ - punctuation -* -| <- - punctuation -abc* -| ^ punctuation.definition.italic.end - -http://spec.commonmark.org/0.27/#example-347 -*foo*bar -| <- punctuation.definition.italic.begin -| ^ punctuation.definition.italic.end - -http://spec.commonmark.org/0.27/#example-348 -_foo bar _ -| <- punctuation.definition.italic.begin -| ^ - punctuation -_ -| <- - punctuation -abc_ -| ^ punctuation.definition.italic.end - -http://spec.commonmark.org/0.27/#example-351 -Intraword emphasis is disallowed for `_`: -_foo_bar -| <- punctuation.definition.italic.begin -| ^ - punctuation -abc_ -| ^ punctuation.definition.italic.end - -http://spec.commonmark.org/0.27/#example-353 -_foo_bar_baz_ -| <- punctuation.definition.italic.begin -| ^^^^^ - punctuation -| ^ punctuation.definition.italic.end - -http://spec.commonmark.org/0.27/#example-354 -_(bar)_. -| <- punctuation.definition.italic.begin -| ^ punctuation.definition.italic.end - -http://spec.commonmark.org/0.27/#example-355 - **foo bar** -|^^ punctuation.definition.bold.begin -| ^^ punctuation.definition.bold.end - -http://spec.commonmark.org/0.27/#example-356 -** foo bar** -| <- - punctuation -| ^^ - punctuation - -http://spec.commonmark.org/0.27/#example-358 -foo**bar** -| ^^ punctuation.definition.bold.begin -| ^^ punctuation.definition.bold.end - -http://spec.commonmark.org/0.27/#example-359 - __foo bar__ -|^^ punctuation.definition.bold.begin -| ^^ punctuation.definition.bold.end - -http://spec.commonmark.org/0.27/#example-360 -This is not strong emphasis, because the opening delimiter is followed by whitespace: -__ foo bar__ -| <- - punctuation -| ^^ - punctuation - -http://spec.commonmark.org/0.27/#example-361 -__ -| <- - punctuation - -http://spec.commonmark.org/0.27/#example-362 -a__"foo"__ -|^^^^^^^^^ - punctuation - -http://spec.commonmark.org/0.27/#example-363 -Intraword strong emphasis is forbidden with `__`: -foo__bar__ -| ^^^^^^^ - punctuation - -http://spec.commonmark.org/0.27/#example-364 -5__6__78 -|^^^^^^^ - punctuation - -http://spec.commonmark.org/0.27/#example-367 -foo-__(bar)__ -| ^^ punctuation.definition.bold.begin -| ^^ punctuation.definition.bold.end - -http://spec.commonmark.org/0.27/#example-368 -**foo bar ** -| <- punctuation.definition.bold.begin -| ^^ - punctuation -abc** -| ^^ punctuation.definition.bold.end - -http://spec.commonmark.org/0.27/#example-373 -Intraword emphasis: - **foo**bar -|^^ punctuation.definition.bold.begin -| ^^ punctuation.definition.bold.end - -http://spec.commonmark.org/0.27/#example-374 - __foo bar __ -|^^ punctuation.definition.bold.begin -| ^^ - punctuation -abc__ -| ^^ punctuation.definition.bold.end - -http://spec.commonmark.org/0.27/#example-376 -_(__foo__)_ -| <- punctuation.definition.italic.begin -| ^^ punctuation.definition.bold.begin -| ^^ punctuation.definition.bold.end -| ^ punctuation.definition.italic.end - -http://spec.commonmark.org/0.27/#example-377 -Intraword strong emphasis is forbidden with `__`: -__foo__bar -| <- punctuation.definition.bold.begin -| ^^ - punctuation -abc__ -| ^^ punctuation.definition.bold.end - -http://spec.commonmark.org/0.27/#example-379 -__foo__bar__baz__ -| <- punctuation.definition.bold.begin -| ^^ punctuation.definition.bold.end -| ^^^^^^^^^^ - punctuation - -http://spec.commonmark.org/0.27/#example-380 -This is strong emphasis, even though the closing delimiter is both left- and right-flanking, because it is followed by punctuation: -__(bar)__. -| <- punctuation.definition.bold.begin -| ^^ punctuation.definition.bold.end - -http://spec.commonmark.org/0.27/#example-381 -*foo [bar](/url)* -| <- punctuation.definition.italic.begin -| ^ punctuation.definition.italic.end -| ^^^^^^^^^^^ meta.link.inline - -http://spec.commonmark.org/0.27/#example-382 -*foo -| <- punctuation.definition.italic.begin -bar* -| ^ punctuation.definition.italic.end - -http://spec.commonmark.org/0.27/#example-383 -_foo __bar__ baz_ -| <- punctuation.definition.italic.begin -| ^^ punctuation.definition.bold.begin -| ^^ punctuation.definition.bold.end -| ^ punctuation.definition.italic.end - -http://spec.commonmark.org/0.27/#example-394 -** is not an empty emphasis -| <- - punctuation -|^ - punctuation - -http://spec.commonmark.org/0.27/#example-395 -**** is not an empty strong emphasis -| <- - punctuation -|^^^ - punctuation - -http://spec.commonmark.org/0.27/#example-396 -**foo [bar](/url)** -| <- punctuation.definition.bold.begin -| ^^^^^^^^^^^ meta.link.inline -| ^^ punctuation.definition.bold.end - -http://spec.commonmark.org/0.27/#example-397 -**foo -| <- punctuation.definition.bold.begin -bar** -| ^^ punctuation.definition.bold.end - -http://spec.commonmark.org/0.27/#example-398 -__foo _bar_ baz__ -| <- punctuation.definition.bold.begin -| ^ punctuation.definition.italic.begin -| ^ punctuation.definition.italic.end -| ^^ punctuation.definition.bold.end - -http://spec.commonmark.org/0.27/#example-408 -__ is not an empty emphasis -| <- - punctuation -|^ - punctuation - -http://spec.commonmark.org/0.27/#example-409 -____ is not an empty strong emphasis -| <- - punctuation -|^^^ - punctuation - - -http://spec.commonmark.org/0.27/#example-410 -foo *** -| ^^^ - punctuation - -http://spec.commonmark.org/0.27/#example-411 -foo *\** -| ^ punctuation.definition.italic.begin -| ^^ constant.character.escape -| ^ punctuation.definition.italic.end - -http://spec.commonmark.org/0.27/#example-412 -foo *_* -| ^ punctuation.definition.italic.begin -| ^ - punctuation -| ^ punctuation.definition.italic.end - -http://spec.commonmark.org/0.27/#example-414 -foo **\*** -| ^^ punctuation.definition.bold.begin -| ^^ constant.character.escape -| ^^ punctuation.definition.bold.end - -http://spec.commonmark.org/0.27/#example-415 -foo **_** -| ^^ punctuation.definition.bold.begin -| ^ - punctuation -| ^^ punctuation.definition.bold.end - -http://spec.commonmark.org/0.27/#example-422 -foo ___ -| ^^^^ - punctuation - -http://spec.commonmark.org/0.27/#example-423 -foo _\__ -| ^ punctuation.definition.italic.begin -| ^^ constant.character.escape -| ^ punctuation.definition.italic.end - -http://spec.commonmark.org/0.27/#example-424 -foo _*_ -| ^ punctuation.definition.italic.begin -| ^ - punctuation -| ^ punctuation.definition.italic.end - -http://spec.commonmark.org/0.27/#example-426 -foo __\___ -| ^^ punctuation.definition.bold.begin -| ^^ constant.character.escape -| ^^ punctuation.definition.bold.end - -http://spec.commonmark.org/0.27/#example-427 -foo __*__ -| ^^ punctuation.definition.bold.begin -| ^ - punctuation -| ^^ punctuation.definition.bold.end - -This text is _bold_, but this__text__is neither bold_nor_italic -| ^ punctuation.definition.italic -| ^^^^ markup.italic -| ^ punctuation.definition.italic -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - markup.bold - markup.italic - -the following is italic *and doesn't end here * but does end here* -| ^ punctuation.definition.italic.begin -| ^ - punctuation.definition.italic -| ^ punctuation.definition.italic.end -the following is bold **and doesn't end here ** but does end here** -| ^^ punctuation.definition.bold.begin -| ^^ - punctuation.definition.bold -| ^^ punctuation.definition.bold.end -the following is not bold ** test **** -| ^^ - punctuation.definition.bold.begin -| ^^^^ - punctuation.definition.bold -the following is not italic _ test ____ -| ^ - punctuation.definition.italic.begin -| ^^^^ - punctuation.definition.italic - -more **tests *** ** here** -| ^^ punctuation.definition.bold.begin -| ^^^^^^ - punctuation.definition -| ^^ punctuation.definition.bold.end -more __tests *** ** example __ here__ -| ^^ punctuation.definition.bold.begin -| ^^^^^^^^^^^^^^^^^^^^^^ - punctuation.definition -| ^^ punctuation.definition.bold.end -more _tests here_ -| ^ punctuation.definition.italic.begin -| ^ - punctuation.definition -| ^ punctuation.definition.italic.end -more _tests _here_ -| ^ punctuation.definition.italic.begin -| ^ - punctuation.definition -| ^ - punctuation -| ^ punctuation.definition.italic.end -_more `tests_` here_ -| <- punctuation.definition.italic.begin -| ^^^^^^^^ markup.raw.inline -| ^ punctuation.definition.italic.end -__more `tests__` here__ -| <- punctuation.definition.bold.begin -| ^^^^^^^^^ markup.raw.inline -| ^^ punctuation.definition.bold.end -**more `tests__` here** -| <- punctuation.definition.bold.begin -| ^^^^^^^^^ markup.raw.inline -| ^^ punctuation.definition.bold.end -**more `tests**` here** -| <- punctuation.definition.bold.begin -| ^^^^^^^^^ markup.raw.inline -| ^^ punctuation.definition.bold.end -*more `tests__` here** -| <- punctuation.definition.italic.begin -| ^^ - punctuation -abc* -| ^ punctuation.definition.italic.end - -_test text_ foobar -| <- punctuation -| ^ punctuation.definition.italic.end -__test text__ not formatted -| <- punctuation -| ^^ punctuation.definition.bold.end -*test text* not formatted -| <- punctuation -| ^ punctuation.definition.italic.end -**test text** not formatted -| <- punctuation -| ^^ punctuation.definition.bold.end -_test text **formatted**_ -| <- punctuation -| ^^ punctuation -| ^^ punctuation -| ^ punctuation -*test text __formatted__* -| <- punctuation -| ^^ punctuation -| ^^ punctuation -| ^ punctuation -*test text __formatted__* **more** _text_ -| <- punctuation -| ^^ punctuation -| ^^ punctuation -| ^ punctuation -| ^^ punctuation -| ^^ punctuation -| ^ punctuation -| ^ punctuation -*test text* __formatted__ -| <- punctuation -| ^ punctuation -| ^^ punctuation -| ^^ punctuation - -__test text__ *formatted* -| <- punctuation -| ^^ punctuation -| ^ punctuation -| ^ punctuation - -This is ***bold italic*** -| ^^^^^^^^^^^^^^^^^ markup.bold -| ^^ punctuation.definition.bold.begin -| ^ punctuation.definition.italic.begin -| ^^^^^^^^^^^^^ markup.italic -| ^ punctuation.definition.italic.end -| ^^ punctuation.definition.bold.end - -This is ***bold italic* and just bold** -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.bold -| ^^ punctuation.definition.bold.begin -| ^ punctuation.definition.italic.begin -| ^^^^^^^^^^^^^ markup.italic -| ^ punctuation.definition.italic.end -| ^^^^^^^^^^^^^^^^ - markup.italic -| ^^ punctuation.definition.bold.end - -The next scope overlap funny because we have to pick one order -to scope three indicators in a row -This is ***bold italic** and just italic* -| ^^^^^^^^^^^^^^^^ markup.bold -| ^^ punctuation.definition.bold.begin -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.italic -| ^ punctuation.definition.italic.begin -| ^^ punctuation.definition.bold.end -| ^^^^^^^^^^^^^^^^^ - markup.bold -| ^ punctuation.definition.italic.end - -This is **_bold italic_** -| ^^^^^^^^^^^^^^^^^ markup.bold -| ^^ punctuation.definition.bold.begin -| ^ punctuation.definition.italic.begin -| ^^^^^^^^^^^^^ markup.italic -| ^ punctuation.definition.italic.end -| ^^ punctuation.definition.bold.end - -This is __*bold italic*__ -| ^^^^^^^^^^^^^^^^^ markup.bold -| ^^ punctuation.definition.bold.begin -| ^ punctuation.definition.italic.begin -| ^^^^^^^^^^^^^ markup.italic -| ^ punctuation.definition.italic.end -| ^^ punctuation.definition.bold.end - -This is ___bold italic___ -| ^^^^^^^^^^^^^^^^^ markup.bold -| ^^ punctuation.definition.bold.begin -| ^ punctuation.definition.italic.begin -| ^^^^^^^^^^^^^ markup.italic -| ^ punctuation.definition.italic.end -| ^^ punctuation.definition.bold.end - -This is ___bold italic_ and just bold__ -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.bold -| ^^ punctuation.definition.bold.begin -| ^ punctuation.definition.italic.begin -| ^^^^^^^^^^^^^ markup.italic -| ^ punctuation.definition.italic.end -| ^^^^^^^^^^^^^^^^ - markup.italic -| ^^ punctuation.definition.bold.end - -The next scope overlap funny because we have to pick one order -to scope three indicators in a row -This is ___bold italic__ and just italic_ -| ^^^^^^^^^^^^^^^ markup.bold -| ^^ punctuation.definition.bold.begin -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.italic -| ^ punctuation.definition.italic.begin -| ^^ punctuation.definition.bold.end -| ^^^^^^^^^^^^^^^^^ - markup.bold -| ^ punctuation.definition.italic.end - -This is _**italic bold**_ -| ^^^^^^^^^^^^^^^^^ markup.italic -| ^ punctuation.definition.italic.begin -| ^^^^^^^^^^^^^^^ markup.bold -| ^^ punctuation.definition.bold.begin -| ^^ punctuation.definition.bold.end -| ^ punctuation.definition.italic.end - -This is *__italic bold__* -| ^^^^^^^^^^^^^^^^^ markup.italic -| ^ punctuation.definition.italic.begin -| ^^^^^^^^^^^^^^^ markup.bold -| ^^ punctuation.definition.bold.begin -| ^^ punctuation.definition.bold.end -| ^ punctuation.definition.italic.end - -**test!_test** Issue 1163 -|^^^^^^^^^^^^^ markup.bold -| ^ - punctuation.definition.italic -| ^^ punctuation.definition.bold.end - -__test!*test__ Issue 1163 -|^^^^^^^^^^^^^ markup.bold -| ^ - punctuation.definition.italic -| ^^ punctuation.definition.bold.end - -# Strikethrough Tests - -__~~bold striked~~__ -| <- markup.bold.markdown punctuation.definition.bold.begin.markdown -|^ markup.bold.markdown - markup.strikethrough -| ^^^^^^^^^^^^^^^^ markup.bold.markdown markup.strikethrough.markdown-gfm -| ^^ markup.bold.markdown - markup.strikethrough -|^ punctuation.definition.bold.begin.markdown -| ^^ punctuation.definition.strikethrough.begin.markdown -| ^^ punctuation.definition.strikethrough.end.markdown -| ^^ punctuation.definition.bold.end.markdown - -**~~bold striked~~** -| <- markup.bold.markdown punctuation.definition.bold.begin.markdown -|^ markup.bold.markdown - markup.strikethrough -| ^^^^^^^^^^^^^^^^ markup.bold.markdown markup.strikethrough.markdown-gfm -| ^^ markup.bold.markdown - markup.strikethrough -|^ punctuation.definition.bold.begin.markdown -| ^^ punctuation.definition.strikethrough.begin.markdown -| ^^ punctuation.definition.strikethrough.end.markdown -| ^^ punctuation.definition.bold.end.markdown - -_~~italic striked~~_ -| <- markup.italic.markdown punctuation.definition.italic.begin.markdown -|^^^^^^^^^^^^^^^^^^ markup.italic.markdown markup.strikethrough.markdown-gfm -| ^ markup.italic.markdown - markup.strikethrough -|^^ punctuation.definition.strikethrough.begin.markdown -| ^^ punctuation.definition.strikethrough.end.markdown -| ^ punctuation.definition.italic.end.markdown - -*~~italic striked~~* -| <- markup.italic.markdown punctuation.definition.italic.begin.markdown -|^^^^^^^^^^^^^^^^^^ markup.italic.markdown markup.strikethrough.markdown-gfm -| ^ markup.italic.markdown - markup.strikethrough -|^^ punctuation.definition.strikethrough.begin.markdown -| ^^ punctuation.definition.strikethrough.end.markdown -| ^ punctuation.definition.italic.end.markdown - -___~~bold italic striked~~___ -| <- markup.bold.markdown punctuation.definition.bold.begin.markdown -|^ markup.bold.markdown - markup.italic - markup.strikethrough -| ^ markup.bold.markdown markup.italic.markdown - markup.strikethrough -| ^^^^^^^^^^^^^^^^^^^^^^^ markup.bold.markdown markup.italic.markdown markup.strikethrough.markdown-gfm -| ^ markup.bold.markdown markup.italic.markdown - markup.strikethrough -| ^^ markup.bold.markdown - markup.italic - markup.strikethrough -|^ punctuation.definition.bold.begin.markdown -| ^ punctuation.definition.italic.begin.markdown -| ^^ punctuation.definition.strikethrough.begin.markdown -| ^^ punctuation.definition.strikethrough.end.markdown -| ^ punctuation.definition.italic.end.markdown -| ^^ punctuation.definition.bold.end.markdown - -***~~bold italic striked~~*** -| <- markup.bold.markdown punctuation.definition.bold.begin.markdown -|^ markup.bold.markdown - markup.italic - markup.strikethrough -| ^ markup.bold.markdown markup.italic.markdown - markup.strikethrough -| ^^^^^^^^^^^^^^^^^^^^^^^ markup.bold.markdown markup.italic.markdown markup.strikethrough.markdown-gfm -| ^ markup.bold.markdown markup.italic.markdown - markup.strikethrough -| ^^ markup.bold.markdown - markup.italic - markup.strikethrough -|^ punctuation.definition.bold.begin.markdown -| ^ punctuation.definition.italic.begin.markdown -| ^^ punctuation.definition.strikethrough.begin.markdown -| ^^ punctuation.definition.strikethrough.end.markdown -| ^ punctuation.definition.italic.end.markdown -| ^^ punctuation.definition.bold.end.markdown - -~Hi~ Hello, world! -| <- punctuation.definition.strikethrough.begin -|^^^ meta.paragraph markup.strikethrough -| ^ punctuation.definition.strikethrough.end -| ^^^^^^^^^^^^^^^ meta.paragraph - markup - -This ~text~~~~ is ~~~~curious~. -| ^^^^^^^^^ meta.paragraph markup.strikethrough -| ^^^^^^^^^^^^ meta.paragraph markup.strikethrough -| ^^ meta.paragraph - markup -| ^ punctuation.definition.strikethrough.begin -| ^^^^ punctuation.definition.strikethrough.end -| ^^^^ punctuation.definition.strikethrough.begin -| ^ punctuation.definition.strikethrough.end - -This ~~has a -| ^^^^^^^^ meta.paragraph markup.strikethrough - -| <- meta.paragraph markup.strikethrough invalid.illegal.non-terminated.bold-italic -new paragraph~~. -| ^^ meta.paragraph markup.strikethrough punctuation.definition.strikethrough.begin - -| <- invalid.illegal.non-terminated.bold-italic - -# Fenced Code Block Tests - -Paragraph is terminated by fenced code blocks. -``` -| <- meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown -``` -| <- meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown - -Code blocks terminate **bold text -``` -| <- meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown -``` -| <- meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown -this must not be bold** -| <- - meta.bold -|^^^^^^^^^^^^^^^^^^^^^^^ - meta.bold - -Code blocks terminate __bold text -``` -| <- meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown -``` -| <- meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown -this must not be bold__ -| <- - meta.bold -|^^^^^^^^^^^^^^^^^^^^^^^ - meta.bold - -Code blocks terminate *italic text -``` -| <- meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown -``` -| <- meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown -this must not be italic* -| <- - meta.italic -|^^^^^^^^^^^^^^^^^^^^^^^ - meta.italic - -Code blocks terminate _italic text -``` -| <- meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown -``` -| <- meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown -this must not be italic_ -| <- - meta.italic -|^^^^^^^^^^^^^^^^^^^^^^^ - meta.bold - meta.italic - -Code blocks terminate ***bold italic text -``` -| <- meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown -``` -| <- meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown -this must not be bold italic*** -| <- - meta.bold - meta.italic -|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.bold - meta.italic - -Code blocks terminate ___bold italic text -``` -| <- meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown -``` -| <- meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown -this must not be bold italic___ -| <- - meta.bold - meta.italic -|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.bold - meta.italic - -Code blocks terminate **_bold italic text -``` -| <- meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown -``` -| <- meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown -this must not be bold italic_** -| <- - meta.bold - meta.italic -|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.bold - meta.italic - -```js -| <- punctuation.definition.raw.code-fence.begin -| ^^ constant.other.language-name -for (var i = 0; i < 10; i++) { -| ^ source.js keyword.control.loop - console.log(i); -} -``` -| <- punctuation.definition.raw.code-fence.end - -```ts -| ^^ constant.other.language-name -declare type foo = 'bar' -| ^^^^ source.ts meta.type-alias keyword.declaration.type -``` - -```R%&?! weired language name -|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.code-fence.definition.begin.text.markdown-gfm -| ^^^^^ constant.other.language-name.markdown -| ^^^^^^^^^^^^^^^^^^^^^ - constant -``` - -```{key: value} -|^^^^^^^^^^^^^^^ meta.code-fence.definition.begin.text.markdown-gfm -| ^^^^^^^^^^^^ - constant -``` - -``` {key: value} -|^^^^^^^^^^^^^^^^ meta.code-fence.definition.begin.text.markdown-gfm -| ^^^^^^^^^^^^ - constant -``` - -```testing``123``` -| <- punctuation.definition.raw.begin -| ^^ - punctuation -| ^^^ punctuation.definition.raw.end -```testing``123```` -| <- punctuation.definition.raw.begin -| ^ - punctuation -| ^^^^ - punctuation -``` -| <- punctuation.definition.raw.end -``testing`123```` -| <- punctuation.definition.raw.begin -| ^ - punctuation -| ^^^^ - punctuation -more text`` -| ^^ punctuation.definition.raw.end -``text - -| <- invalid.illegal.non-terminated.raw -text -| <- - markup.raw - -http://spec.commonmark.org/0.28/#example-315 -`` foo ` bar `` -|^ punctuation.definition.raw.begin -|^^^^^^^^^^^^^^^ markup.raw.inline -| ^ - punctuation -| ^^ punctuation.definition.raw.end - -http://spec.commonmark.org/0.28/#example-316 -` `` ` -|<- punctuation.definition.raw.begin -|^^^^^ markup.raw.inline -| ^^ - punctuation -| ^ punctuation.definition.raw.end - -http://spec.commonmark.org/0.28/#example-318 -`foo bar - baz` -|^^^^^ markup.raw.inline -| ^ punctuation.definition.raw.end - -~~~~ -| <- punctuation.definition.raw.code-fence.begin - ~~~~ -| ^^^ punctuation.definition.raw.code-fence.end - -~~~~~test~ -| ^^^^^^^^^ meta.paragraph - constant - markup.raw - -~~~~~~test -| ^^^^ punctuation.definition.raw.code-fence.begin -| ^^^^ constant.other.language-name -~~~~~~ -| ^^^^ punctuation.definition.raw.code-fence.end - -```test -| ^^^^ constant.other.language-name - ``` -| ^^^ punctuation.definition.raw.code-fence.end - -hello world ````test```` -| ^^^^^^^^^^^^ markup.raw.inline -| ^ - markup.raw - -`foo `` bar` -| ^^^^^^ markup.raw.inline - punctuation -| ^ punctuation.definition.raw.end - -hard line break -| ^^ meta.hard-line-break punctuation.definition.hard-line-break -hard line break\ -| ^ meta.hard-line-break constant.character.escape -hard line break -| ^^^^^ meta.hard-line-break punctuation.definition.hard-line-break -soft line break -| ^^ - meta.hard-line-break -soft line break -| ^^ - meta.hard-line-break - -### foo -| ^^^ - meta.hard-line-break -### foo\ -| ^ - meta.hard-line-break - -`inline code with trailing spaces -| ^^^ - meta.hard-line-break -not a hard line break` - -*test - -| <- invalid.illegal.non-terminated.bold-italic -abc* -| ^ - punctuation - -_test - -| <- invalid.illegal.non-terminated.bold-italic -abc_ -| ^ - punctuation - -**test - -| <- invalid.illegal.non-terminated.bold-italic -abc** -| ^^ - punctuation - -__test - -| <- invalid.illegal.non-terminated.bold-italic -abc__ -| ^^ - punctuation - -__test\ -| ^ meta.hard-line-break constant.character.escape -testing__ - -- test *testing -blah* -| ^ markup.list.unnumbered meta.paragraph.list markup.italic punctuation.definition.italic.end - meta.paragraph.list meta.paragraph.list -- fgh -- *ghgh -| ^ markup.list.unnumbered meta.paragraph.list markup.italic punctuation.definition.italic.begin - meta.paragraph.list meta.paragraph.list -- fgfg -| <- markup.list.unnumbered.bullet punctuation.definition.list_item -- _test - -| <- markup.list.unnumbered meta.paragraph.list markup.italic invalid.illegal.non-terminated.bold-italic - still a list item -| ^^^^^^^^^^^^^^^^^^ markup.list.unnumbered meta.paragraph.list -- * * * * * * * -| <- punctuation.definition.list_item -| ^^^^^^^^ markup.list.unnumbered meta.paragraph.list meta.separator.thematic-break - meta.paragraph.list meta.paragraph.list -| ^ punctuation.definition.thematic-break -| ^ punctuation.definition.thematic-break -| ^ punctuation.definition.thematic-break -| ^ punctuation.definition.thematic-break -| ^ punctuation.definition.thematic-break -| ^ punctuation.definition.thematic-break -| ^ punctuation.definition.thematic-break -| ^ - punctuation.definition.thematic-break -| ^ - punctuation.definition.thematic-break -| ^ - punctuation.definition.thematic-break -| ^ - punctuation.definition.thematic-break -| ^ - punctuation.definition.thematic-break -| ^ - punctuation.definition.thematic-break - still a list item -| ^^^^^^^^^^^^^^^^^^ markup.list.unnumbered meta.paragraph.list - meta.paragraph.list meta.paragraph.list - -http://spec.commonmark.org/0.27/#example-407 -**foo [*bar*](/url)** -| <- punctuation.definition.bold.begin -| ^^^^^^^^^^^^^ markup.bold meta.link.inline -| ^^ punctuation.definition.bold.end -| ^ punctuation.definition.italic.begin -| ^ punctuation.definition.italic.end -**foo [_bar_](/url)** -| <- punctuation.definition.bold.begin -| ^^^^^^^^^^^^^ markup.bold meta.link.inline -| ^^ punctuation.definition.bold.end -| ^ punctuation.definition.italic.begin -| ^ punctuation.definition.italic.end -_foo [**bar**](/url)_ -| <- punctuation.definition.italic.begin -| ^^^^^^^^^^^^^^^ markup.italic meta.link.inline -| ^ punctuation.definition.italic.end -| ^^ punctuation.definition.bold.begin -| ^^ punctuation.definition.bold.end - - -1. Open `Command Palette` using menu item `Tools → Command Palette...` -|^ markup.list.numbered punctuation.definition.list_item -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.list.numbered meta.paragraph.list markup.raw.inline -2. Choose `Package Control: Install Package` - -[**Read more →**][details] -|^^ punctuation.definition.bold.begin -| ^^^^^^^ constant.character.entity.decimal.html -| ^^ punctuation.definition.bold.end -| ^^^^^^^ constant.other.reference.link - -[Read more →][details] -| ^^^^^^^ constant.character.entity.decimal.html -| ^^^^^^^ constant.other.reference.link - -[Read more ][details] -|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.reference.description -| ^^^^^^^^^^^^^^^^^^ source.css -| ^^^^^^^ constant.character.entity.decimal.html -| ^^^^^^^ constant.other.reference.link - -[![Cool ★ Image - Click to Enlarge][img-example]][img-example] -|^ punctuation.definition.image.begin -| ^^^^^^^^^^^ constant.other.reference.link -| ^ punctuation.definition.link.end -| ^^^^^^^^^^^ constant.other.reference.link - -[![Cool ★ Image - Click to Enlarge](http://www.sublimetext.com/anim/rename2_packed.png)](http://www.sublimetext.com/anim/rename2_packed.png) -|^ punctuation.definition.image.begin -| ^ punctuation.definition.metadata.begin -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.image -| ^ punctuation.definition.metadata.end -| ^ punctuation.definition.metadata.begin -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link -| ^ punctuation.definition.metadata.end - -[img-example]: http://www.sublimetext.com/anim/rename2_packed.png -|^^^^^^^^^^^ meta.link.reference.def entity.name.reference.link -| ^ punctuation.separator.key-value -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link -| ^ - meta.link - markup - -[//]: # (This is a comment without a line-break.) -| ^ meta.link.reference.def markup.underline.link -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.other.link.description.title -| ^ - meta.link - -[//]: # (This is a comment with a -| ^ meta.link.reference.def markup.underline.link -| ^ punctuation.definition.string.begin - line-break.) -| ^ punctuation.definition.string.end -| ^ - meta.link - -[//]: # (testing)blah -|^^^^^^^^^^^^^^^^^^^^ meta.link.reference.def.markdown -| ^ punctuation.definition.string.begin -| ^ punctuation.definition.string.end -| ^^^^ invalid.illegal.expected-eol -| ^ - meta.link - invalid - -[//]: # (testing -blah -| <- meta.link.reference.def string.other.link.description.title - -| <- invalid.illegal.non-terminated.link-title -text -| <- meta.paragraph - meta.link.reference.def - -[foo]: "test" -|^^^^^^^^^^^^^^^^^^^ meta.link.reference.def.markdown -| ^ - meta.link -| ^ punctuation.definition.link.begin -| ^^^ markup.underline.link -| ^ punctuation.definition.link.end -| ^^^^^^ string.other.link.description.title -| ^ - invalid.illegal.expected-eol - -[foo]: > "test" -|^^^^^^^^^^^^^^^^^^^^ meta.link.reference.def.markdown -| ^ - meta.link -| ^ punctuation.definition.link.begin -| ^^^ markup.underline.link -| ^ punctuation.definition.link.end -| ^^^^^^^^ invalid.illegal.expected-eol -| ^ - invalid.illegal.expected-eol - -https://michelf.ca/projects/php-markdown/extra/#footnotes -That's some text with a footnote.[^1] -| ^^^^ meta.paragraph meta.link.reference.footnote.markdown-extra -| ^^ punctuation.definition.link.begin -| ^ meta.link.reference.literal.footnote-id -| ^ punctuation.definition.link.end - - [^1]: And that's the footnote. -|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.reference.def.footnote.markdown-extra -|^ punctuation.definition.constant.begin -| ^ punctuation.definition.constant.end -| ^^ entity.name.reference.link -| ^ punctuation.separator.key-value - -[^1]: - And that's the footnote. - - That's the *second* paragraph. -|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.reference.def.footnote.markdown-extra - markup.raw -| ^^^^^^^^ markup.italic - - [^footnote](not_link_dest) -|^^^^^^^^^^^ meta.paragraph.markdown meta.link.reference.footnote.markdown-extra -|^^ punctuation.definition.link.begin.markdown -| ^^^^^^^^ meta.link.reference.literal.footnote-id.markdown -| ^ punctuation.definition.link.end.markdown -| ^^^^^^^^^^^^^^^ meta.paragraph.markdown - meta.link.inline.markdown - -- a - - b - - c - - d -| ^ markup.list.unnumbered.bullet punctuation.definition.list_item - text here -| ^^^^^^^^^^ markup.list.unnumbered meta.paragraph.list - markup.raw.block - meta.paragraph.list meta.paragraph.list - - code here - | ^^^^^^^^ markup.raw.block - - - e -| ^ markup.list.unnumbered.bullet punctuation.definition.list_item - - code here - - > block quote code here -| ^ markup.list.unnumbered markup.quote punctuation.definition.blockquote -| ^^^^^^^^^^^^^^^^^^^^^^ markup.list.unnumbered markup.quote markup.raw.block - - > > test -| ^ markup.list.unnumbered markup.quote punctuation.definition.blockquote -| ^ markup.list.unnumbered markup.quote markup.quote punctuation.definition.blockquote - markup.raw.block - - - f -| ^ markup.list.unnumbered.bullet punctuation.definition.list_item - 1. test -| ^^ markup.list.numbered.bullet -| ^ punctuation.definition.list_item - -abc -| <- meta.paragraph - markup.list - -| foo | bar | -|^^^^^^^^^^^^^ meta.block-level meta.table.header -| <- punctuation.separator.table-cell -| ^ punctuation.separator.table-cell -| ^ punctuation.separator.table-cell -| ^^^^ - punctuation.separator.table-cell -| --- | --- | -| baz | bim Ctrl+C | -| <- meta.block-level meta.table punctuation.separator.table-cell -| ^^^^^ meta.tag.inline.any -| ^ punctuation.separator.table-cell - -| <- - meta.block-level - meta.table - -| abc | defghi | -:-: | -----------: -|^^^^^^^^^^^^^^^^^ meta.block-level meta.table.header-separator -| <- punctuation.definition.table-cell-alignment -|^ punctuation.section.table-header -| ^ punctuation.separator.table-cell -| ^^^^^^^^^^^ punctuation.section.table-header -| ^ punctuation.definition.table-cell-alignment - punctuation.section.table-header -bar | baz -| ^ meta.block-level meta.table punctuation.separator.table-cell - -| f\|oo | -| <- meta.block-level meta.table punctuation.separator.table-cell -| ^^ meta.block-level meta.table constant.character.escape - punctuation.separator.table-cell -| ^ meta.block-level meta.table punctuation.separator.table-cell -| ------ | -| b `|` az | -| ^^^ meta.block-level meta.table markup.raw.inline - meta.table.header-separator -| ^ meta.block-level meta.table punctuation.separator.table-cell -| b **|** im | -| <- meta.block-level meta.table punctuation.separator.table-cell -| ^^^^^ meta.block-level meta.table markup.bold - punctuation.separator.table-cell -| ^ meta.block-level meta.table punctuation.separator.table-cell - -| abc | def | -| --- | --- | -| bar | baz | -|^^^^^^^^^^^^^ meta.block-level meta.table -test -|^^^^ meta.block-level meta.table -> bar -| <- meta.block-level markup.quote punctuation.definition.blockquote - meta.table - -`|` this `|` example `|` is not a table `|` -| ^ punctuation.definition.raw.end - meta.table -| nor is this | because it is not at block level, it immediately follows a paragraph | -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.paragraph - meta.table - -| First Header | Second Header | Third Header | -| :------------ | :-----------: | -------------------: | -| First row | Data | Very long data entry | -| Second row | **Cell** | *Cell* | -| Third row | Cell that spans across two columns || -| ^^^^^^^^^^^^^^ meta.block-level meta.table -| ^^ punctuation.separator.table-cell - - | table that doesn't start at column 0 | - | ---- | - | blah | -| ^^^^^^^^ meta.table -| ^ punctuation.separator.table-cell - -not a table | -| ^^^^^^^^^^^^^ - meta.table - - abc | def - --- | --- - --- | --- -| ^^^^ meta.block-level meta.table - meta.table.header - - a | b - - | - -|^^^^^^ meta.block-level.markdown meta.table.header-separator.markdown-gfm -|^ punctuation.section.table-header.markdown -| ^ punctuation.separator.table-cell.markdown -| ^ punctuation.section.table-header.markdown - - | - -|^^^^^^ meta.block-level.markdown meta.table.markdown-gfm - - a | b - -:| - -|^^^^^^ meta.block-level.markdown meta.table.header-separator.markdown-gfm -|^ punctuation.section.table-header.markdown -| ^ punctuation.definition.table-cell-alignment.markdown -| ^ punctuation.separator.table-cell.markdown -| ^ punctuation.section.table-header.markdown - - | - -|^^^^^^ meta.block-level.markdown meta.table.markdown-gfm - -| test | me | -|------|----| -|^^^^^^ punctuation.section.table-header -|*test | me | -|^^^^^^ - markup.bold -| ^ punctuation.separator.table-cell -| ^ punctuation.separator.table-cell -|`test | me | -|^ invalid.deprecated.unescaped-backticks -| ^ punctuation.separator.table-cell - -A line without bolded | -| ^ - punctuation.separator.table-cell - -A line with bolded **|** -| ^ - punctuation.separator.table-cell - -1. test -| ^^^^^ markup.list.numbered meta.paragraph.list - - test -|^^^^^^^^^ markup.list.unnumbered -| ^ markup.list.unnumbered.bullet punctuation.definition.list_item -| ^^^^^ meta.paragraph.list - - test -|^^^^^^^^^ markup.list.unnumbered -| ^ markup.list.unnumbered.bullet punctuation.definition.list_item -| ^^^^^ meta.paragraph.list - test -|^^^^^^^ markup.list.numbered meta.paragraph.list - ****test**** -|^^^^^^^^^^^^^ markup.list.numbered meta.paragraph.list - punctuation - - - - test -|^ punctuation.definition.list_item -| ^^^^^^^ markup.list.unnumbered meta.paragraph.list - punctuation -- - - - test -| <- punctuation.definition.list_item -| ^^^^^^^^^^^ markup.list.unnumbered meta.paragraph.list - punctuation - -paragraph - - * List Item 1 - Text under Item 1 - * List Item 2 - Text under Item 2 - - * List Item 3 - Text under Item 3 -| ^^^^^^^^^^^^^^^^^^ markup.list.unnumbered meta.paragraph.list - markup.raw - - 1. fenced code block inside a list item -| ^ punctuation.definition.list_item - ```language -|^^^^^^^^^^^^^^^ meta.paragraph.list -| ^^^ punctuation.definition.raw.code-fence.begin -| ^^^^^^^^ constant.other.language-name -| ^^^^^^^^^^^ meta.code-fence - -|^^^^ meta.paragraph.list markup.raw.code-fence - ``` -| ^^^ punctuation.definition.raw.code-fence.end - test -| ^^^^^ meta.paragraph.list - markup.raw.code-fence - - 2. test -| ^ punctuation.definition.list_item - -Normal paragraph -| <- meta.paragraph - markup - -1. List - 1. Nested list - 2. Second item - - This line is still list item 1 -|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.list.numbered - markup.raw.block - -Test -| <- meta.paragraph - markup.list - -http://spec.commonmark.org/0.28/#example-116 - -
-
-**Hello**,
-| ^^^^^^^^^ meta.disable-markdown
-
-_world_.
-| ^^^^ markup.italic - meta.disable-markdown
-
-
- -http://spec.commonmark.org/0.28/#example-120 - -
-| ^^^^^^^^^^^^^^^^ meta.disable-markdown - -*Markdown* -| ^^^^^^^ meta.paragraph markup.italic - meta.disable-markdown - -
-| ^^^ meta.disable-markdown meta.tag.block.any.html - -http://spec.commonmark.org/0.28/#example-127 - -
-| ^^^^^ meta.disable-markdown - markup.italic - -http://spec.commonmark.org/0.28/#example-129 - -
-``` c -int x = 33; -``` -| ^^ meta.disable-markdown - -http://spec.commonmark.org/0.28/#example-130 - - -*bar* -|^^^^^ meta.disable-markdown - - -http://spec.commonmark.org/0.28/#example-131 - - -*bar* -|^^^^^ meta.disable-markdown - -| ^^^^^^^ meta.disable-markdown meta.tag.other.html entity.name.tag.other.html - -http://spec.commonmark.org/0.28/#example-135 - - -| ^^ meta.disable-markdown meta.tag.inline.any.html entity.name.tag.inline.any.html - -*foo* -| ^^ meta.paragraph markup.italic - - -| ^^^ meta.disable-markdown meta.tag.inline.any.html entity.name.tag.inline.any.html - - -*foo* -|^^^^^ meta.disable-markdown - - -http://spec.commonmark.org/0.28/#example-136 - -*foo* -| ^^ meta.tag.inline.any.html entity.name.tag.inline.any.html -| ^^^^^ markup.italic -| ^^^ meta.tag.inline.any.html entity.name.tag.inline.any.html -|^^^^^^^^^^^^^^^ meta.paragraph - meta.disable-markdown - -http://spec.commonmark.org/0.28/#example-137 - -

-| ^^ meta.disable-markdown meta.tag.block.any.html entity.name.tag.block.any.html
-import Text.HTML.TagSoup
-
-main :: IO ()
-| ^^^^^^^^^^^^ meta.disable-markdown
-main = print $ parseTags tags
-
-| ^^^^^^^^^^^ meta.disable-markdown -| ^^^ meta.tag.block.any.html entity.name.tag.block.any.html -okay -| <- - meta.disable-markdown - -http://spec.commonmark.org/0.28/#example-138 - - -| ^^^^^^ meta.disable-markdown meta.tag.script.end.html entity.name.tag.script.html -okay -| <- - meta.disable-markdown - -http://spec.commonmark.org/0.28/#example-139 - - -| ^^^^^ meta.disable-markdown meta.tag.style.end.html entity.name.tag.style.html -okay -| <- - meta.disable-markdown - -http://spec.commonmark.org/0.28/#example-143 - - -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.disable-markdown -*foo* -| <- - meta.disable-markdown - -http://spec.commonmark.org/0.28/#example-144 - -*bar* -| ^^^^^^^^^^ comment.block.html -| ^^^^^ meta.disable-markdown -*baz* -| <- - meta.disable-markdown - -http://spec.commonmark.org/0.28/#example-145 - -1. *bar* -| ^^^^^^^^^^^^^^^^ meta.disable-markdown -okay -| <- - meta.disable-markdown - -http://spec.commonmark.org/0.28/#example-146 - - -| ^^^^^^^^ meta.disable-markdown comment.block.html -okay -| <- - meta.disable-markdown - -http://spec.commonmark.org/0.28/#example-147 - -'; - -?> -|^^ meta.disable-markdown -okay -| <- - meta.disable-markdown - -http://spec.commonmark.org/0.28/#example-148 - - -| ^^^^^^^ meta.disable-markdown meta.tag.sgml.doctype.html keyword.declaration.doctype.html -okay -| <- - meta.disable-markdown - -http://spec.commonmark.org/0.28/#example-149 - - -|^ meta.disable-markdown meta.tag.sgml.cdata.html -okay -| <- - meta.disable-markdown - -1. Test - - ```python -| ^^^ markup.list.numbered meta.code-fence punctuation.definition.raw.code-fence.begin - Test - -| <- - invalid - Test - ``` -| ^^^ punctuation.definition.raw.code-fence.end - -1. Test 2 -|^ markup.list.numbered.bullet punctuation.definition.list_item - -```clojure -|^^^^^^^^^ meta.code-fence.definition.begin.clojure -| ^^^^^^^ constant.other.language-name - (/ 10 3.0) -|<- source.clojure -|^^^^^^^^^^ source.clojure -| ^ variable.function -| ^^ meta.number -| ^^^ meta.number -``` -|^^ meta.code-fence.definition.end.clojure punctuation.definition.raw.code-fence.end - -```diff -+ inserted -| <- source.diff markup.inserted.diff punctuation.definition.inserted.diff -- deleted -| <- source.diff markup.deleted.diff punctuation.definition.deleted.diff -``` - -```haskell - -| <- markup.raw.code-fence.haskell.markdown-gfm source.haskell -``` - -```html - -| <- markup.raw.code-fence.html.markdown-gfm text.html -| ^^^^^^ text.html meta.tag -``` - -```jsx - -| <- markup.raw.code-fence.jsx.markdown-gfm source.jsx -| ^^^^^^^^^^^ source.jsx meta.jsx.js -``` - -```lisp - -| <- markup.raw.code-fence.lisp.markdown-gfm source.lisp -``` - -```lua - -| <- markup.raw.code-fence.lua.markdown-gfm source.lua -``` - -```matlab - -| <- markup.raw.code-fence.matlab.markdown-gfm source.matlab -``` - -```ocaml - -| <- markup.raw.code-fence.ocaml.markdown-gfm source.ocaml -``` - -```scala - -| <- markup.raw.code-fence.scala.markdown-gfm source.scala -``` - -```sh - -| <- markup.raw.code-fence.shell-script.markdown-gfm source.shell.bash -``` - -```shell - -| <- markup.raw.code-fence.shell-script.markdown-gfm source.shell.bash -``` - -```shell-script - -| <- markup.raw.code-fence.shell-script.markdown-gfm source.shell.bash -``` - -```tsx - -| <- markup.raw.code-fence.tsx.markdown-gfm source.tsx -| ^^^^^^^^^^^ markup.raw.code-fence.tsx.markdown-gfm source.tsx meta.jsx.js -``` - -```xml -|^^^^^ meta.code-fence.definition.begin.xml -| ^^^ constant.other.language-name - -|^^^^^^^^^^^^^^^^^^^^^^ markup.raw.code-fence.xml -| ^^^^^^^ meta.tag.preprocessor.xml entity.other.attribute-name.localname.xml - - - -``` -|^^ punctuation.definition.raw.code-fence.end - -```sql -|^^^^^ meta.code-fence.definition.begin.sql -| ^^^ constant.other.language-name -SELECT TOP 10 * -|^^^^^^^^^^^^^^^ markup.raw.code-fence.sql -|^^^^^^^^^ keyword.other.DML.sql -FROM TableName -``` -|^^ meta.code-fence.definition.end.sql punctuation.definition.raw.code-fence.end - markup - -```python -|^^ punctuation.definition.raw.code-fence.begin -|^^^^^^^^^ meta.code-fence.definition.begin.python - markup -| ^^^^^^ constant.other.language-name -def function(): - pass -| ^^^^ keyword.control.flow.pass.python -unclosed_paren = ( -| ^ meta.group.python punctuation.section.group.begin.python -``` -|^^ meta.code-fence.definition.end.python punctuation.definition.raw.code-fence.end - -```Graphviz -graph n {} -| ^^^ storage.type.dot -``` - -| <- - markup.raw - -```php -var_dump(expression); -| ^^^^^^ support.function.var.php -``` - -```html+php -
-|^^^ entity.name.tag.block.any.html -= => <=> // && == != -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - constant - keyword - variable - - -= += /= %= -- ++ ** !~ =~ ~~ <= >= => <=> // && == != -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block-level markup.raw - constant - keyword - variable - punctuation - -> -= += /= %= -- ++ ** !~ =~ ~~ <= >= => <=> // && == != -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block-level - constant - keyword - variable - -> > -= += /= %= -- ++ ** !~ =~ ~~ <= >= => <=> // && == != -| ^ meta.block-level.markdown markup.quote.markdown markup.quote.markdown punctuation.definition.blockquote.markdown -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block-level - constant - keyword - variable - -\
-|<- constant.character.escape -|^ constant.character.escape -|^^^^^^ - meta.tag - -\ -|^ constant.character.escape -|^^^^^^ - meta.tag -| ^^ constant.character.escape - -link with a single underscore inside the text : [@_test](http://example.com) -| ^^^^^^ meta.paragraph meta.link.inline.description - punctuation.definition -| ^ meta.paragraph meta.link.inline punctuation.definition.link.end - -# h1 -- list -## h2 -|^ punctuation.definition.heading.begin -1. list -### h3 -|^^ punctuation.definition.heading.begin - -1. list [001]blah -| ^^^^^ meta.link.reference -| ^ punctuation.definition.link.begin -| ^ punctuation.definition.link.end -| ^^^^^ - meta.link - - [001]: https://en.wikipedia.org/wiki/Root-mean-square_deviation "Wikipedia - RMSE" -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.list.numbered meta.link.reference.def -1. another list item - -[foo]: /url "title" -|^^^^^^^^^^^^^^^^^^ meta.link.reference.def -| ^ punctuation.separator.key-value -| ^^^^ markup.underline.link -| ^^^^^^^ string.other.link.description.title - -[foo] -|<- meta.link.reference punctuation.definition.link.begin -|^^^ meta.paragraph meta.link.reference -| ^ meta.link.reference punctuation.definition.link.end - - [Foo*bar\]]:my_(url) 'title (with parens)' -|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.reference.def -|^ punctuation.definition.constant.begin -| ^^^^^^^^^ entity.name.reference.link - punctuation -| ^ punctuation.definition.constant.end -| ^ punctuation.separator.key-value -| ^^^^^^^^ markup.underline.link -| ^^^^^^^^^^^^^^^^^^^^^ string.other.link.description.title - - [foo]: <> -|^^^^^^^^^ meta.link.reference.def -| ^ punctuation.separator.key-value -| ^ punctuation.definition.link.begin -| ^ punctuation.definition.link.end - -# CriticMarkup ################################################################ - -This is an {++additional++} word in {++**bold**++}. -| ^^^^^^^^^^^^^^^^ markup.critic.addition.markdown -| ^^^ punctuation.definition.critic.begin.markdown - markup.inserted -| ^^^^^^^^^^ markup.inserted.critic.markdown -| ^^^ punctuation.definition.critic.end.markdown - markup.inserted -| ^^^ markup.critic.addition.markdown - markup.inserted - markup.bold -| ^^^^^^^^ markup.critic.addition.markdown markup.inserted.critic.markdown markup.bold.markdown -| ^^^ markup.critic.addition.markdown - markup.inserted -| ^^^ punctuation.definition.critic.begin.markdown -| ^^ punctuation.definition.bold.begin.markdown -| ^^ punctuation.definition.bold.end.markdown -| ^^^ punctuation.definition.critic.end.markdown - -This is an {++ multiline -addition ++} test. -| <- markup.critic.addition.markdown -|^^^^^^^^ markup.critic.addition.markdown markup.inserted.critic.markdown -| ^^^ markup.critic.addition.markdown - markup.inserted -| ^^^ punctuation.definition.critic.end.markdown -| ^^^^^^ - markup.critic - -Additional {++[Link](https://foo.bar)++} and {++![Image](images/image.png)++}. -| ^^^^^^^^^ - markup.critic -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.critic.addition.markdown -| ^^^^ - markup.critic -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.critic.addition.markdown -| ^^ - markup.critic -| ^^^ punctuation.definition.critic.begin.markdown -| ^ meta.link.inline.markdown punctuation.definition.link.begin.markdown -| ^^^^ meta.link.inline.description.markdown -| ^ meta.link.inline.markdown punctuation.definition.link.end.markdown -| ^^^^^^^^^^^^^^^^^ meta.link.inline.markdown -| ^^^ punctuation.definition.critic.end.markdown -| ^^^ punctuation.definition.critic.begin.markdown -| ^^ meta.image.inline.markdown punctuation.definition.image.begin.markdown -| ^^^^^ meta.image.inline.description.markdown -| ^ meta.image.inline.markdown punctuation.definition.image.end.markdown -| ^^^^^^^^^^^^^^^^^^ meta.image.inline.markdown -| ^^^ punctuation.definition.critic.end.markdown - -This is a {-- deletion --} and {~~substitute~>with~~striked~~text~~} or {~~~~old~~~>~~new~~~~}. -| ^^^^^^^^^^^^^^^^ markup.critic.deletion.markdown -| ^^^ punctuation.definition.critic.begin.markdown - markup.deleted -| ^^^^^^^^^^ markup.deleted.critic.markdown -| ^^^ punctuation.definition.critic.end.markdown - markup.deleted -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.critic.substitution.markdown -| ^^^ - markup.critic -| ^^^^^^^^^^^^^^^^^^^^^^ markup.critic.substitution.markdown -| ^^ - markup.critic -| ^^^ punctuation.definition.critic.begin.markdown - markup.deleted -| ^^^^^^^^^^ markup.deleted.critic.markdown -| ^^ punctuation.separator.critic.markdown - markup.deleted - markup.inserted -| ^^^^^^^^^^^^^^^^^^ markup.inserted.critic.markdown -| ^^^^^^^^^^ markup.strikethrough.markdown-gfm -| ^^^ punctuation.definition.critic.end.markdown - markup.inserted -| ^^^ punctuation.definition.critic.begin.markdown -| ^^ punctuation.definition.strikethrough.begin.markdown -| ^^^^^^^ markup.deleted.critic.markdown markup.strikethrough.markdown-gfm -| ^^ punctuation.definition.strikethrough.end.markdown -| ^^ punctuation.separator.critic.markdown -| ^^ punctuation.definition.strikethrough.begin.markdown -| ^^^^^^^ markup.inserted.critic.markdown markup.strikethrough.markdown-gfm -| ^^ punctuation.definition.strikethrough.end.markdown -| ^^^ punctuation.definition.critic.end.markdown - -This is a {>> comment <<}. -| ^^^^^^^^^^^^^^^ markup.critic.comment.markdown -| ^^^ punctuation.definition.critic.begin.markdown - comment -| ^^^^^^^^^ comment.critic.markdown -| ^^^ punctuation.definition.critic.end.markdown - comment -| ^ - markup.critic - -This is an {== information ==}{>> comment <<}. -| ^^^^^^^^^^^^^^^^^^^ markup.critic.highlight.markdown -| ^^^^^^^^^^^^^^^ markup.critic.comment.markdown -| ^^^ punctuation.definition.critic.begin.markdown - markup.info -| ^^^^^^^^^^^^^ markup.info.critic.markdown -| ^^^ punctuation.definition.critic.end.markdown - markup.info -| ^^^ punctuation.definition.critic.begin.markdown - comment -| ^^^^^^^^^ comment.critic.markdown -| ^^^ punctuation.definition.critic.end.markdown - comment -| ^^ - markup.critic diff --git a/Markdown/tests/syntax_test_markdown.md b/Markdown/tests/syntax_test_markdown.md new file mode 100644 index 0000000000..2cad89fedf --- /dev/null +++ b/Markdown/tests/syntax_test_markdown.md @@ -0,0 +1,7869 @@ +| SYNTAX TEST "Packages/Markdown/Markdown.sublime-syntax" + +# TEST: Tabs ################################################################## + +## https://spec.commonmark.org/0.30/#example-1 + + foo baz bim +| <- markup.raw.block.markdown +|^^^^^^^^^^^^^ markup.raw.block.markdown + +## https://spec.commonmark.org/0.30/#example-2 + + foo baz bim +| <- markup.raw.block.markdown +|^^^^^^^^^^^^^ markup.raw.block.markdown + + foo baz bim +| <- markup.raw.block.markdown +|^^^^^^^^^^^^^ markup.raw.block.markdown + +## https://spec.commonmark.org/0.30/#example-3 + + a a + ὐ a +| <- markup.raw.block.markdown +|^^^^^^^ markup.raw.block.markdown + +## https://spec.commonmark.org/0.30/#example-4 + + - foo + + bar +| <- markup.list.unnumbered.markdown +|^^^^ markup.list.unnumbered.markdown + +## https://spec.commonmark.org/0.30/#example-5 + +- foo + + bar +| <- markup.list.unnumbered.markdown - markup.raw.block.markdown +|^^^^^ markup.list.unnumbered.markdown - markup.raw.block.markdown + +> Note: `bar` should be indented code block, but ST can't reliably highlight it! + +## https://spec.commonmark.org/0.30/#example-6 + +> foo +| <- markup.quote.markdown punctuation.definition.blockquote.markdown +|^^^^^^ markup.quote.markdown markup.raw.block.markdown + +## https://spec.commonmark.org/0.30/#example-7 + +- foo +| <- markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown + + +## https://spec.commonmark.org/0.30/#example-8 + + foo + bar +| <- markup.raw.block.markdown +|^^^^ markup.raw.block.markdown + +## https://spec.commonmark.org/0.30/#example-9 + + - foo + - bar + - baz +|^ markup.list.unnumbered.markdown +| ^ markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown +| ^^^^ markup.list.unnumbered.markdown + +## https://spec.commonmark.org/0.30/#example-10 + +# Foo +| <- markup.heading.1.markdown punctuation.definition.heading.begin.markdown +|^^^^^ markup.heading.1.markdown - punctuation + +## https://spec.commonmark.org/0.30/#example-11 + +* * * +| <- meta.separator.thematic-break.markdown punctuation.definition.thematic-break.markdown +|^^^^^^ meta.separator.thematic-break.markdown +| ^ punctuation.definition.thematic-break.markdown +| ^ punctuation.definition.thematic-break.markdown + +- - - +| <- meta.separator.thematic-break.markdown punctuation.definition.thematic-break.markdown +|^^^^^^ meta.separator.thematic-break.markdown +| ^ punctuation.definition.thematic-break.markdown +| ^ punctuation.definition.thematic-break.markdown + +_ _ _ +| <- meta.separator.thematic-break.markdown punctuation.definition.thematic-break.markdown +|^^^^^^ meta.separator.thematic-break.markdown +| ^ punctuation.definition.thematic-break.markdown +| ^ punctuation.definition.thematic-break.markdown + + +# TEST: LIGATURES ############################################################# + +this is a raw ampersand & does not require HTML escaping +| ^ - entity - illegal + +this is a raw bracket < > does not require HTML escaping +| ^^^ - meta.tag - punctuation + +these are raw ligatures << <<< <<<< <<<<< >>>>> >>>> >>> >> +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.other.valid-bracket - meta.tag + +these are raw ligatures <- <-- <--- <---- <-< <--< <---< <----< +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.other.valid-bracket - meta.tag + +these are raw ligatures -> --> ---> ----> >-> >--> >---> >----> +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.other.valid-bracket - meta.tag + +these are raw ligatures >- >-- >--- >---- ----< ---< --< -< +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.other.valid-bracket - meta.tag + +these are raw ligatures >< >-< >--< >---< <---> <--> <-> <> +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.other.valid-bracket - meta.tag + +these are raw ligatures <= <== <=== <==== <=< <==< <===< <====< +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.other.valid-bracket - meta.tag + +these are raw ligatures => ==> ===> ====> >=> >==> >===> >====> +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.other.valid-bracket - meta.tag + +these are raw ligatures >= >== >=== >==== ====< ===< ==< =< +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.other.valid-bracket - meta.tag + +these are raw ligatures >< >=< >==< >===< <===> <==> <=> <> +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.other.valid-bracket - meta.tag + +these are raw ligatures - -- --- ---- ----- ===== ==== === == = +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.other.valid-bracket - meta.tag + +-= += /= %= -- ++ ** !~ =~ ~~ <= >= => <=> // && == != +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - constant - keyword - variable + + -= += /= %= -- ++ ** !~ =~ ~~ <= >= => <=> // && == != +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.raw - constant - keyword - variable - punctuation + +> -= += /= %= -- ++ ** !~ =~ ~~ <= >= => <=> // && == != +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - constant - keyword - variable + +> > -= += /= %= -- ++ ** !~ =~ ~~ <= >= => <=> // && == != +| ^ markup.quote.markdown punctuation.definition.blockquote.markdown +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - constant - keyword - variable + + +# TEST: BACKSLASH ESCAPES ##################################################### + +## https://spec.commonmark.org/0.30/#example-12 + +\!\"\#\$\%\&\'\(\)\*\+\,\-\.\/\:\;\<\=\>\?\@\[\\\]\^\_\`\{\|\}\~ +| <- constant.character.escape.markdown +|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.character.escape.markdown + +## https://spec.commonmark.org/0.30/#example-13 + +\ \A\a\ \3\φ\« +| <- - constant.character.escape +|^^^^^^^^^^^^^ - constant.character.escape + +## https://spec.commonmark.org/0.30/#example-14 + +\*not emphasized* +| <- constant.character.escape.markdown +|^ constant.character.escape.markdown +|^^^^^^^^^^^^^^^^ - markup.italic + +\
not a tag +| <- constant.character.escape.markdown +|^ constant.character.escape.markdown +|^^^^^ - markup.tag + +\
not a tag +| <- constant.character.escape.markdown +|^^^^^^ - meta.tag +| ^^ constant.character.escape + +\[not a link](/foo) +| <- constant.character.escape.markdown +|^ constant.character.escape.markdown +|^^^^^^^^^^^^^^^^^^ - markup.link + +\`not code` +| <- constant.character.escape.markdown +|^ constant.character.escape.markdown +|^^^^^^^^^ - markup.raw + +1\. not a list +|^^ constant.character.escape.markdown +|^^^^^^^^^^^^^ - markup.list + +\* not a list +| <- constant.character.escape.markdown +|^ constant.character.escape.markdown +|^^^^^^^^^^^^ - markup.list + +\# not a heading +| <- constant.character.escape.markdown +|^ constant.character.escape.markdown +|^^^^^^^^^^^^^^^ - markup.heading + +\[foo]: /url "not a reference" +| <- constant.character.escape.markdown +|^ constant.character.escape.markdown +|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.link + +\ö not a character entity +| <- constant.character.escape.markdown +|^ constant.character.escape.markdown +|^^^^^^ - entity + +\~/.bashrc +| <- constant.character.escape.markdown +|^ constant.character.escape.markdown + +## https://spec.commonmark.org/0.30/#example-15 + +\\*emphasis* +| <- constant.character.escape.markdown +|^ constant.character.escape.markdown +| ^^^^^^^^^^ markup.italic.markdown + +\\_emphasis_ +| <- constant.character.escape.markdown +|^ constant.character.escape.markdown +| ^^^^^^^^^^ markup.italic.markdown + +## https://spec.commonmark.org/0.30/#example-16 + +foo\ +| ^ meta.hard-line-break.markdown constant.character.escape.markdown +| ^ meta.hard-line-break.markdown - constant +bar + +## https://spec.commonmark.org/0.30/#example-17 + +`` \[\` `` +|^^^^^^^^^ markup.raw.inline.markdown - constant.character.escape + +## https://spec.commonmark.org/0.30/#example-18 + + \[\] +|^^^^^^^^ markup.raw.block.markdown - constant.character.escape + +## https://spec.commonmark.org/0.30/#example-19 + +~~~ +\[\] +|^^^^ markup.raw.code-fence.markdown-gfm - constant.character.escape +~~~ + +## https://spec.commonmark.org/0.30/#example-20 + + +| ^^ - constant.character.escape + +## https://spec.commonmark.org/0.30/#example-21 + + +| ^^ - constant.character.escape + +## https://spec.commonmark.org/0.30/#example-22 + +[foo](/bar\* "ti\*tle") +| ^^ markup.underline.link.markdown constant.character.escape +| ^^ constant.character.escape + +## https://spec.commonmark.org/0.30/#example-23 + +[foo] + +[foo]: /bar\* "ti\*tle" +| ^^ markup.underline.link.markdown constant.character.escape +| ^^ constant.character.escape + +## https://spec.commonmark.org/0.30/#example-24 + +Note: current design doesn't support highlighting escapes in info strings +``` foo\+bar +| ^^ - constant.character.escape +foo +``` + + +# TEST: HTML ENTITIES ######################################################### + +## https://spec.commonmark.org/0.30/#example-25 + +   & © Æ Ď +| ^^^^^^ constant.character.entity.named.html +| ^ - constant +| ^^^^^ constant.character.entity.named.html +| ^ - constant +| ^^^^^^ constant.character.entity.named.html +| ^ - constant +| ^^^^^^^ constant.character.entity.named.html +| ^ - constant +| ^^^^^^^^ constant.character.entity.named.html +| ^ - constant + + ¾ ℋ ⅆ +| ^^^^^^^^ constant.character.entity.named.html +| ^ - constant +| ^^^^^^^^^^^^^^ constant.character.entity.named.html +| ^ - constant +| ^^^^^^^^^^^^^^^ constant.character.entity.named.html +| ^ - constant + + ∲ ≧̸ +| ^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.character.entity.named.html +| ^ - constant +| ^^^^^ constant.character.entity.named.html +| ^ - constant + +## https://spec.commonmark.org/0.30/#example-26 + + # Ӓ Ϡ � +| ^^^^^ constant.character.entity.decimal.html +| ^ - constant +| ^^^^^^^ constant.character.entity.decimal.html +| ^ - constant +| ^^^^^^ constant.character.entity.decimal.html +| ^ - constant +| ^^^^ constant.character.entity.decimal.html +| ^ - constant + +## https://spec.commonmark.org/0.30/#example-27 + + " ആ ಫ +| ^^^^^^ constant.character.entity.hexadecimal.html +| ^ - constant +| ^^^^^^^ constant.character.entity.hexadecimal.html +| ^ - constant +| ^^^^^^^ constant.character.entity.hexadecimal.html +| ^ - constant + +## https://spec.commonmark.org/0.30/#example-28 + + & +| ^ - constant - invalid + +   &x; &#; &#x; +| ^^^^^^ - constant +| ^^^ constant.character.entity.named.html +| ^^^^^^^^^ - constant + + � + + &#abcdef0; +| ^^^^^^^^^^ - constant + + &hi?; +| ^^^^^ - constant + +Note: ST's HTML or Markdown don't maintain a full list of valid html5 entities + for simplicity reasons and therefore invalid entities are highlighted. + +## https://spec.commonmark.org/0.30/#example-29 + +Although HTML5 does accept some entity references without a trailing semicolon +(such as ©), these are not recognized here, because it makes the grammar +too ambiguous: + + © +| ^^^^^ - constant + +## https://spec.commonmark.org/0.30/#example-30 + +Strings that are not on the list of HTML5 named entities are not recognized as +entity references either: + + &MadeUpEntity; +| ^^^^^^^^^^^^^^ constant.character.entity.named.html + +Note: ST's HTML or Markdown don't maintain a full list of valid html5 entities + for simplicity reasons and therefore invalid entities are highlighted. + +## https://spec.commonmark.org/0.30/#example-31 + + +| ^^^^^^^^^^^^ constant.character.entity.named.html + +## https://spec.commonmark.org/0.30/#example-32 + +[foo](/föö "föö") +| ^^^^^^^^^^^^ constant.character.entity.named.html +| ^^^^^^^^^^^^ constant.character.entity.named.html + +## https://spec.commonmark.org/0.30/#example-33 + +[foo] + +[foo]: /föö "föö" +| ^^^^^^^^^^^^ constant.character.entity.named.html +| ^^^^^^^^^^^^ constant.character.entity.named.html + +## https://spec.commonmark.org/0.30/#example-34 + +``` föö +foo +``` +Note: current design doesn't support highlighting entities in info strings + +## https://spec.commonmark.org/0.30/#example-35 + +`föö` +|^^^^^^^^^^^^^ - constant.character.entity + +## https://spec.commonmark.org/0.30/#example-36 + + föfö +| ^^^^^^^^^^^^^^ - constant.character.entity + +## https://spec.commonmark.org/0.30/#example-37 + +*foo* +| <- meta.paragraph.markdown constant.character.entity.decimal.html +|^^^^^^^^^^^^^ meta.paragraph.markdown - markup.italic +|^^^^ constant.character.entity.decimal.html +| ^^^^^ constant.character.entity.decimal.html + +*foo* +| <- meta.paragraph.markdown markup.italic.markdown +|^^^^ meta.paragraph.markdown markup.italic.markdown + +## https://spec.commonmark.org/0.30/#example-38 + +* foo +| <- meta.paragraph.markdown constant.character.entity.decimal.html +|^^^^^^^^^ meta.paragraph.markdown +|^^^^ constant.character.entity.decimal.html + +* foo +| <- markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown +|^^^^^ markup.list.unnumbered.markdown + +## https://spec.commonmark.org/0.30/#example-39 + +foo bar +| <- meta.paragraph.markdown +|^^^^^^^^^^^^^^^^ meta.paragraph.markdown +| ^^^^^^^^^^ constant.character.entity.decimal.html + +## https://spec.commonmark.org/0.30/#example-40 + + foo +| <- meta.paragraph.markdown constant.character.entity.decimal.html +|^^^ meta.paragraph.markdown constant.character.entity.decimal.html +| ^^^^ meta.paragraph.markdown - constant + +## https://spec.commonmark.org/0.30/#example-41 + +[a](url "tit") +| ^^^^^^^^^^^^^^^^^ meta.paragraph.markdown - meta.link +| ^^^^^^ constant.character.entity.named.html +| ^^^ - constant +| ^^^^^^ constant.character.entity.named.html + + +# TEST: THEMATIC BREAKS ####################################################### + +## https://spec.commonmark.org/0.30/#example-43 + +*** +|^^^ meta.separator.thematic-break.markdown +|^^ punctuation.definition.thematic-break.markdown + +--- +|^^^ meta.separator.thematic-break.markdown +|^^ punctuation.definition.thematic-break.markdown + +___ +|^^^ meta.separator.thematic-break.markdown +|^^ punctuation.definition.thematic-break.markdown + +## https://spec.commonmark.org/0.30/#example-44 + ++++ +| <- - meta.separator +|^^^ - meta.separator + +## https://spec.commonmark.org/0.30/#example-45 + +=== +| <- - meta.separator +|^^^ - meta.separator + +## https://spec.commonmark.org/0.30/#example-46 + +** +| <- - meta.separator +|^ - meta.separator + +-- +| <- - meta.separator +|^ - meta.separator + +__ +| <- - meta.separator +|^ - meta.separator + +## https://spec.commonmark.org/0.30/#example-47 + + *** +|<- meta.separator.thematic-break.markdown - punctuation +|^^^ meta.separator.thematic-break.markdown punctuation.definition.thematic-break.markdown + + *** +|<- meta.separator.thematic-break.markdown - punctuation +|^ meta.separator.thematic-break.markdown - punctuation +| ^^^ meta.separator.thematic-break.markdown punctuation.definition.thematic-break.markdown + + *** +|<- meta.separator.thematic-break.markdown - punctuation +|^^ meta.separator.thematic-break.markdown - punctuation +| ^^^ meta.separator.thematic-break.markdown punctuation.definition.thematic-break.markdown + +## https://spec.commonmark.org/0.30/#example-48 + + *** +|<- markup.raw.block.markdown +|^^^^^^^ markup.raw.block.markdown + +## https://spec.commonmark.org/0.30/#example-49 + +Foo + *** +| <- meta.paragraph.markdown +|^^^^^^^ meta.paragraph.markdown + +## https://spec.commonmark.org/0.30/#example-50 + +************************************** +| <- meta.separator.thematic-break.markdown punctuation.definition.thematic-break.markdown +|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.separator.thematic-break.markdown punctuation.definition.thematic-break.markdown + +-------------------------------------- +| <- meta.separator.thematic-break.markdown punctuation.definition.thematic-break.markdown +|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.separator.thematic-break.markdown punctuation.definition.thematic-break.markdown + +_____________________________________ +| <- meta.separator.thematic-break.markdown punctuation.definition.thematic-break.markdown +|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.separator.thematic-break.markdown punctuation.definition.thematic-break.markdown + +## https://spec.commonmark.org/0.30/#example-51 + + * * * +| <- meta.separator.thematic-break.markdown - punctuation +|^^^^^^ meta.separator.thematic-break.markdown +|^ punctuation.definition.thematic-break.markdown +| ^ - punctuation +| ^ punctuation.definition.thematic-break.markdown +| ^ - punctuation +| ^ punctuation.definition.thematic-break.markdown +| ^ - punctuation + + - - - +| <- meta.separator.thematic-break.markdown - punctuation +|^^^^^^ meta.separator.thematic-break.markdown +|^ punctuation.definition.thematic-break.markdown +| ^ - punctuation +| ^ punctuation.definition.thematic-break.markdown +| ^ - punctuation +| ^ punctuation.definition.thematic-break.markdown +| ^ - punctuation + + _ _ _ +| <- meta.separator.thematic-break.markdown - punctuation +|^^^^^^ meta.separator.thematic-break.markdown +|^ punctuation.definition.thematic-break.markdown +| ^ - punctuation +| ^ punctuation.definition.thematic-break.markdown +| ^ - punctuation +| ^ punctuation.definition.thematic-break.markdown +| ^ - punctuation + +## https://spec.commonmark.org/0.30/#example-52 + + ** * ** * ** * ** +| <- meta.separator.thematic-break.markdown - punctuation +|^^^^^^^^^^^^^^^^^^^ meta.separator.thematic-break.markdown +|^^ punctuation.definition.thematic-break.markdown +| ^^ - punctuation +| ^ punctuation.definition.thematic-break.markdown +| ^ - punctuation +| ^^ punctuation.definition.thematic-break.markdown +| ^ - punctuation +| ^ punctuation.definition.thematic-break.markdown +| ^ - punctuation +| ^^ punctuation.definition.thematic-break.markdown +| ^ - punctuation +| ^ punctuation.definition.thematic-break.markdown +| ^ - punctuation +| ^^ punctuation.definition.thematic-break.markdown +| ^ - punctuation + + -- - -- - -- - -- +| <- meta.separator.thematic-break.markdown - punctuation +|^^^^^^^^^^^^^^^^^^^ meta.separator.thematic-break.markdown +|^^ punctuation.definition.thematic-break.markdown +| ^^ - punctuation +| ^ punctuation.definition.thematic-break.markdown +| ^ - punctuation +| ^^ punctuation.definition.thematic-break.markdown +| ^ - punctuation +| ^ punctuation.definition.thematic-break.markdown +| ^ - punctuation +| ^^ punctuation.definition.thematic-break.markdown +| ^ - punctuation +| ^ punctuation.definition.thematic-break.markdown +| ^ - punctuation +| ^^ punctuation.definition.thematic-break.markdown +| ^ - punctuation + + __ _ __ _ __ _ __ +| <- meta.separator.thematic-break.markdown - punctuation +|^^^^^^^^^^^^^^^^^^^ meta.separator.thematic-break.markdown +|^^ punctuation.definition.thematic-break.markdown +| ^^ - punctuation +| ^ punctuation.definition.thematic-break.markdown +| ^ - punctuation +| ^^ punctuation.definition.thematic-break.markdown +| ^ - punctuation +| ^ punctuation.definition.thematic-break.markdown +| ^ - punctuation +| ^^ punctuation.definition.thematic-break.markdown +| ^ - punctuation +| ^ punctuation.definition.thematic-break.markdown +| ^ - punctuation +| ^^ punctuation.definition.thematic-break.markdown +| ^ - punctuation + +## https://spec.commonmark.org/0.30/#example-53 + +* * * * +| <- meta.separator.thematic-break.markdown punctuation.definition.thematic-break.markdown +|^^^^^^^^^^^^^^^^^^^^^ meta.separator.thematic-break.markdown +|^^^^^ - punctuation +| ^ punctuation.definition.thematic-break.markdown +| ^^^^^^ - punctuation +| ^ punctuation.definition.thematic-break.markdown +| ^^^^^^ - punctuation +| ^ punctuation.definition.thematic-break.markdown +| ^ - punctuation + +- - - - +| <- meta.separator.thematic-break.markdown punctuation.definition.thematic-break.markdown +|^^^^^^^^^^^^^^^^^^^^^ meta.separator.thematic-break.markdown +|^^^^^ - punctuation +| ^ punctuation.definition.thematic-break.markdown +| ^^^^^^ - punctuation +| ^ punctuation.definition.thematic-break.markdown +| ^^^^^^ - punctuation +| ^ punctuation.definition.thematic-break.markdown +| ^ - punctuation + +_ _ _ _ +| <- meta.separator.thematic-break.markdown punctuation.definition.thematic-break.markdown +|^^^^^^^^^^^^^^^^^^^^^ meta.separator.thematic-break.markdown +|^^^^^ - punctuation +| ^ punctuation.definition.thematic-break.markdown +| ^^^^^^ - punctuation +| ^ punctuation.definition.thematic-break.markdown +| ^^^^^^ - punctuation +| ^ punctuation.definition.thematic-break.markdown +| ^ - punctuation + +## https://spec.commonmark.org/0.30/#example-54 + +* * * * +| <- meta.separator.thematic-break.markdown punctuation.definition.thematic-break.markdown +|^^^^^^^ meta.separator.thematic-break.markdown +|^ - punctuation +| ^ punctuation.definition.thematic-break +| ^ - punctuation +| ^ punctuation.definition.thematic-break +| ^ - punctuation +| ^ punctuation.definition.thematic-break +| ^ - punctuation + +- - - - +| <- meta.separator.thematic-break.markdown punctuation.definition.thematic-break.markdown +|^^^^^^^ meta.separator.thematic-break.markdown +|^ - punctuation +| ^ punctuation.definition.thematic-break +| ^ - punctuation +| ^ punctuation.definition.thematic-break +| ^ - punctuation +| ^ punctuation.definition.thematic-break +| ^ - punctuation + +_ _ _ _ +| <- meta.separator.thematic-break.markdown punctuation.definition.thematic-break.markdown +|^^^^^^^ meta.separator.thematic-break.markdown +|^ - punctuation +| ^ punctuation.definition.thematic-break +| ^ - punctuation +| ^ punctuation.definition.thematic-break +| ^ - punctuation +| ^ punctuation.definition.thematic-break +| ^ - punctuation + +## https://spec.commonmark.org/0.30/#example-55 + +_ _ _ _ a +| <- meta.paragraph.markdown - meta.separator +|^^^^^^^^^ meta.paragraph.markdown - meta.separator + +a------ +| <- meta.paragraph.markdown - meta.separator +|^^^^^^^ meta.paragraph.markdown - meta.separator + +---a--- +| <- meta.paragraph.markdown - meta.separator +|^^^^^^^ meta.paragraph.markdown - meta.separator + +## https://spec.commonmark.org/0.30/#example-56 + + *-* +| <- meta.paragraph.markdown - meta.separator +|^^^ meta.paragraph.markdown - meta.separator + +## https://spec.commonmark.org/0.30/#example-57 + +- foo +*** +| <- meta.separator.thematic-break.markdown punctuation.definition.thematic-break.markdown +|^^ meta.separator.thematic-break.markdown punctuation.definition.thematic-break.markdown +- bar +| <- markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown + +## https://spec.commonmark.org/0.30/#example-58 + +Foo +*** +| <- meta.separator.thematic-break.markdown punctuation.definition.thematic-break.markdown +|^^ meta.separator.thematic-break.markdown punctuation.definition.thematic-break.markdown +bar +| <- meta.paragraph.markdown + +## https://spec.commonmark.org/0.30/#example-59 + +Foo +--- +| <- markup.heading.2.markdown punctuation.definition.heading.setext.markdown +|^^ markup.heading.2.markdown punctuation.definition.heading.setext.markdown +bar +| <- meta.paragraph.markdown + +## https://spec.commonmark.org/0.30/#example-60 + +* Foo +* * * +| <- meta.separator.thematic-break.markdown punctuation.definition.thematic-break.markdown +|^^^^^ meta.separator.thematic-break.markdown +| ^ punctuation.definition.thematic-break.markdown +| ^ punctuation.definition.thematic-break.markdown +* Bar +| <- markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown + +## https://spec.commonmark.org/0.30/#example-61 + +- Foo +- * * * +| ^^^^^^ markup.list.unnumbered.markdown meta.separator.thematic-break.markdown + + +# TEST: ATX HEADINGS ########################################################## + +## https://spec.commonmark.org/0.30/#example-62 + +# foo +| <- markup.heading.1.markdown punctuation.definition.heading.begin.markdown +|^^^^^ markup.heading.1.markdown - punctuation + +## foo +| <- markup.heading.2.markdown punctuation.definition.heading.begin.markdown +|^ markup.heading.2.markdown punctuation.definition.heading.begin.markdown +| ^^^^^ markup.heading.2.markdown - punctuation + +### foo +| <- markup.heading.3.markdown punctuation.definition.heading.begin.markdown +|^^ markup.heading.3.markdown punctuation.definition.heading.begin.markdown +| ^^^^^ markup.heading.3.markdown - punctuation + +#### foo +| <- markup.heading.4.markdown punctuation.definition.heading.begin.markdown +|^^^ markup.heading.4.markdown punctuation.definition.heading.begin.markdown +| ^^^^^ markup.heading.4.markdown - punctuation + +##### foo +| <- markup.heading.5.markdown punctuation.definition.heading.begin.markdown +|^^^^ markup.heading.5.markdown punctuation.definition.heading.begin.markdown +| ^^^^^ markup.heading.5.markdown - punctuation + +###### foo +| <- markup.heading.6.markdown punctuation.definition.heading.begin.markdown +|^^^^^ markup.heading.6.markdown punctuation.definition.heading.begin.markdown +| ^^^^^ markup.heading.6.markdown - punctuation + +## https://spec.commonmark.org/0.30/#example-63 + +####### foo +| <- meta.paragraph.markdown - markup.heading +|^^^^^^^^^^^ meta.paragraph.markdown - markup.heading + +## https://spec.commonmark.org/0.30/#example-64 + +#5 bolt +| <- meta.paragraph.markdown - markup.heading +|^^^^^^^ meta.paragraph.markdown - markup.heading + +#hashtag +| <- meta.paragraph.markdown - markup.heading +|^^^^^^^^ meta.paragraph.markdown - markup.heading + +## https://spec.commonmark.org/0.30/#example-65 + +\## foo +| <- meta.paragraph.markdown constant.character.escape.markdown - markup +|^ meta.paragraph.markdown constant.character.escape.markdown - markup +| ^^^^^^ meta.paragraph.markdown - constant - markup + +## https://spec.commonmark.org/0.30/#example-66 + +# foo *bar* \*baz\* +| <- markup.heading.1.markdown punctuation.definition.heading.begin.markdown +|^ markup.heading.1.markdown - entity.name - markup.italic +| ^^^^ markup.heading.1.markdown entity.name.section.markdown - markup.italic +| ^^^^^ markup.heading.1.markdown entity.name.section.markdown markup.italic.markdown +| ^^^^^^^^ markup.heading.1.markdown entity.name.section.markdown - markup.italic + +## https://spec.commonmark.org/0.30/#example-67 + +# foo +| <- markup.heading.1.markdown punctuation.definition.heading.begin.markdown +|^^^^^^^^^^^^^^^^^^ markup.heading.1.markdown - entity.name +| ^^^ markup.heading.1.markdown entity.name.section.markdown +| ^^^^^^^^^^^^^^^^^^^^^^ markup.heading.1.markdown - entity.name + +## https://spec.commonmark.org/0.30/#example-68 + + ### foo +| <- markup.heading.3.markdown +|^^^^^^^^ markup.heading.3.markdown + ## foo +| <- markup.heading.2.markdown +|^^^^^^^^ markup.heading.2.markdown + # foo +| <- markup.heading.1.markdown +|^^^^^^^^ markup.heading.1.markdown + +## https://spec.commonmark.org/0.30/#example-69 + + # foo +| <- markup.raw.block.markdown +|^^^^^^^^^ markup.raw.block.markdown + +## https://spec.commonmark.org/0.30/#example-70 + +foo + # bar +| <- meta.paragraph.markdown - markup.heading +|^^^^^^^^^ meta.paragraph.markdown - markup.heading + +## https://spec.commonmark.org/0.30/#example-71 + +## foo ## + ### bar ### +| <- markup.heading.3.markdown +|^^^^^^^^^^^^^^^^^^ markup.heading.3.markdown +| ^^^ punctuation.definition.heading.begin.markdown +| ^^^ - entity - punctuation +| ^^^ entity.name.section.markdown +| ^^^^ - entity - punctuation +| ^^^ punctuation.definition.heading.end.markdown +| ^ - punctuation + +## https://spec.commonmark.org/0.30/#example-72 + +# foo ################################## +##### foo ## +| <- markup.heading.5.markdown punctuation.definition.heading.begin.markdown +|^^^^^^^^^^^^ markup.heading.5.markdown +|^^^^ punctuation.definition.heading.begin.markdown +| ^ - entity - punctuation +| ^^^ entity.name.section.markdown +| ^ - entity - punctuation +| ^^ punctuation.definition.heading.end.markdown +| ^ - punctuation + +## https://spec.commonmark.org/0.30/#example-73 + +### foo ### +| <- markup.heading.3.markdown punctuation.definition.heading.begin.markdown +|^^^^^^^^^^^^^^^^ markup.heading.3.markdown +|^^ punctuation.definition.heading.begin.markdown +| ^ - entity - punctuation +| ^^^ entity.name.section.markdown +| ^ - entity - punctuation +| ^^^ punctuation.definition.heading.end.markdown +| ^^^^^^ - punctuation + +## https://spec.commonmark.org/0.30/#example-74 + +### foo ### b +| <- markup.heading.3.markdown punctuation.definition.heading.begin.markdown +|^^^^^^^^^^^^^ markup.heading.3.markdown +|^^ punctuation.definition.heading.begin.markdown +| ^ - entity - punctuation +| ^^^^^^^^^ entity.name.section.markdown +| ^ - entity + +## https://spec.commonmark.org/0.30/#example-75 + +# foo# +| <- markup.heading.1.markdown punctuation.definition.heading.begin.markdown +|^^^^^^ markup.heading.1.markdown +|^ - entity - punctuation +| ^^^^ entity.name.section.markdown +| ^ - entity + +# foo# # +| <- markup.heading.1.markdown punctuation.definition.heading.begin.markdown +|^^^^^^^^ markup.heading.1.markdown +|^ - entity - punctuation +| ^^^^ entity.name.section.markdown +| ^ - entity - punctuation +| ^ punctuation.definition.heading.end.markdown +| ^ - punctuation + +## https://spec.commonmark.org/0.30/#example-76 + +### foo \### +| <- markup.heading.3.markdown punctuation.definition.heading.begin.markdown +|^^^^^^^^^^^^ markup.heading.3.markdown +|^^ punctuation.definition.heading.begin.markdown +| ^^^^^^^^ entity.name.section.markdown +| ^^ constant.character.escape.markdown +| ^ - constant - entity - punctuation + +## foo #\## +| <- markup.heading.2.markdown punctuation.definition.heading.begin.markdown +|^^^^^^^^^^^ markup.heading.2.markdown +|^ punctuation.definition.heading.begin.markdown +| ^^^^^^^^ entity.name.section.markdown +| ^^ constant.character.escape.markdown +| ^ - constant - entity - punctuation + +# foo \# +| <- markup.heading.1.markdown punctuation.definition.heading.begin.markdown +|^^^^^^^^ markup.heading.1.markdown +| ^^^^^^ entity.name.section.markdown +| ^^ constant.character.escape.markdown +| ^ - constant - entity - punctuation + +## https://spec.commonmark.org/0.30/#example-77 + +**** +## foo +| <- markup.heading.2.markdown punctuation.definition.heading.begin.markdown +|^^^^^^ markup.heading.2.markdown + +**** +## foo +**** +| <- meta.separator.thematic-break.markdown punctuation.definition.thematic-break.markdown +|^^^ meta.separator.thematic-break.markdown punctuation.definition.thematic-break.markdown + +## https://spec.commonmark.org/0.30/#example-78 + +Foo bar +# baz +| <- markup.heading.1.markdown punctuation.definition.heading.begin.markdown +|^^^^^ markup.heading.1.markdown + +Foo bar +# baz +Bar foo +| <- meta.paragraph.markdown - markup.heading +|^^^^^^^ meta.paragraph.markdown - markup.heading + +Foo **bar +# baz +| <- markup.heading.1.markdown punctuation.definition.heading.begin.markdown - markup.bold +|^^^^^ markup.heading.1.markdown +this must not be bold** +| <- - meta.bold +|^^^^^^^^^^^^^^^^^^^^^^ - meta.bold + +Foo *bar +# baz +| <- markup.heading.1.markdown punctuation.definition.heading.begin.markdown - markup.italic +|^^^^ markup.heading.1.markdown +this must not be italic* +| <- - meta.italic +|^^^^^^^^^^^^^^^^^^^^^^^ - meta.italic + +Foo ***bar +# baz +| <- markup.heading.1.markdown punctuation.definition.heading.begin.markdown - markup.bold - markup.italic +|^^^^^ markup.heading.1.markdown +this must not be bold italic*** +| <- - meta.bold - markup.italic +|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.bold - markup.italic + +## https://spec.commonmark.org/0.30/#example-79 + +# +| <- markup.heading.1.markdown punctuation.definition.heading.begin.markdown + +# # +| <- markup.heading.1.markdown punctuation.definition.heading.begin.markdown +|^^^ markup.heading.1.markdown - entity.name.section +| ^ punctuation.definition.heading.end.markdown + +## +| <- markup.heading.2.markdown punctuation.definition.heading.begin.markdown - entity.name.section +|^ markup.heading.2.markdown punctuation.definition.heading.begin.markdown - entity.name.section + +## ## +| <- markup.heading.2.markdown punctuation.definition.heading.begin.markdown - entity.name.section +|^^^^^ markup.heading.2.markdown - entity.name.section +|^ punctuation.definition.heading.begin.markdown +| ^^ punctuation.definition.heading.end.markdown + +### ### +| <- markup.heading.3.markdown - entity.name.sectionpunctuation.definition.heading.begin.markdown +|^^^^^^^ markup.heading.3.markdown - entity.name.section +|^^ punctuation.definition.heading.begin.markdown +| ^^^ punctuation.definition.heading.end.markdown + +# #### # +| <- markup.heading.1.markdown punctuation.definition.heading.begin.markdown +|^^^^^^^^ markup.heading.1.markdown +|^ - entity.name.section +| ^^^^ entity.name.section.markdown +| ^^ - entity.name.section +| ^ punctuation.definition.heading.end.markdown + +## #### ## +| <- markup.heading.2.markdown punctuation.definition.heading.begin.markdown +|^^^^^^^^^^ markup.heading.2.markdown +|^ - entity.name.section +| ^^^^ entity.name.section.markdown +| ^^^ - entity.name.section +| ^^ punctuation.definition.heading.end.markdown + + +# TEST: SETEXT HEADINGS ####################################################### + +SETEXT Heading Level 1 +| <- markup.heading.1.markdown entity.name.section.markdown +================= +| <- markup.heading.1.markdown punctuation.definition.heading.setext.markdown +|^^^^^^^^^^^^^^^^ markup.heading.1.markdown punctuation.definition.heading.setext.markdown +| ^ markup.heading.1.markdown meta.whitespace.newline.markdown + +SETEXT Heading Level 2 +| <- markup.heading.2.markdown entity.name.section.markdown +------------------------------ +| <- markup.heading.2.markdown punctuation.definition.heading.setext.markdown +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.heading.2.markdown punctuation.definition.heading.setext.markdown +| ^ markup.heading.2.markdown meta.whitespace.newline.markdown - punctuation + +underlined heading followed by a separator +------------------- +------ +| <- meta.separator.thematic-break.markdown - markup.heading + +underlined heading followed by another one that should be treated as a normal paragraph +================== +===== +| <- meta.paragraph.markdown - markup.heading + +https://spec.commonmark.org/0.30/#example-80 + +Foo *bar* +| <- markup.heading.1.markdown entity.name.section.markdown +|^^^^^^^^^ markup.heading.1.markdown entity.name.section.markdown +| ^^^^^ markup.italic.markdown +========= +| <- markup.heading.1.markdown punctuation.definition.heading.setext.markdown +|^^^^^^^^ markup.heading.1.markdown punctuation.definition.heading.setext.markdown +| ^ markup.heading.1.markdown meta.whitespace.newline.markdown + +Foo *bar* +| <- markup.heading.2.markdown entity.name.section.markdown +|^^^^^^^^^ markup.heading.2.markdown entity.name.section.markdown +| ^^^^^ markup.italic.markdown +--------- +| <- markup.heading.2.markdown punctuation.definition.heading.setext.markdown +|^^^^^^^^ markup.heading.2.markdown punctuation.definition.heading.setext.markdown +| ^ markup.heading.2.markdown meta.whitespace.newline.markdown + +Foo *bar +| <- markup.heading.1.markdown entity.name.section.markdown +|^^^^^^^^^ markup.heading.1.markdown entity.name.section.markdown +| ^^^^^ markup.italic.markdown +========= +| <- markup.heading.1.markdown punctuation.definition.heading.setext.markdown - markup.italic +|^^^^^^^^ markup.heading.1.markdown punctuation.definition.heading.setext.markdown - markup.italic +| ^ markup.heading.1.markdown meta.whitespace.newline.markdown - markup.italic + +Foo *bar +| <- markup.heading.2.markdown entity.name.section.markdown +|^^^^^^^^^ markup.heading.2.markdown entity.name.section.markdown +| ^^^^^ markup.italic.markdown +--------- +| <- markup.heading.2.markdown punctuation.definition.heading.setext.markdown - markup.italic +|^^^^^^^^ markup.heading.2.markdown punctuation.definition.heading.setext.markdown - markup.italic +| ^ markup.heading.2.markdown meta.whitespace.newline.markdown - markup.italic + +https://spec.commonmark.org/0.30/#example-81 + +Foo *bar +baz* +| <- markup.heading.1.markdown entity.name.section.markdown markup.italic.markdown +|^^^ markup.heading.1.markdown entity.name.section.markdown markup.italic.markdown +| ^ markup.heading.1.markdown entity.name.section.markdown - markup.italic +==== +| <- markup.heading.1.markdown punctuation.definition.heading.setext.markdown +|^^^ markup.heading.1.markdown punctuation.definition.heading.setext.markdown +| ^ markup.heading.1.markdown meta.whitespace.newline.markdown + +https://spec.commonmark.org/0.30/#example-82 + + Foo *bar +baz* +| <- markup.heading.1.markdown entity.name.section.markdown markup.italic.markdown +|^^^ markup.heading.1.markdown entity.name.section.markdown markup.italic.markdown +| ^^ markup.heading.1.markdown entity.name.section.markdown - markup.italic +==== +| <- markup.heading.1.markdown punctuation.definition.heading.setext.markdown +|^^^ markup.heading.1.markdown punctuation.definition.heading.setext.markdown +| ^ markup.heading.1.markdown meta.whitespace.newline.markdown + +https://spec.commonmark.org/0.30/#example-83 + +Foo += +| <- markup.heading.1.markdown punctuation.definition.heading.setext.markdown +|^ markup.heading.1.markdown meta.whitespace.newline.markdown + +Foo +- +| <- markup.heading.2.markdown punctuation.definition.heading.setext.markdown +|^ markup.heading.2.markdown meta.whitespace.newline.markdown + +https://spec.commonmark.org/0.30/#example-84 + + Foo +--- +| <- markup.heading.2.markdown punctuation.definition.heading.setext.markdown +|^^ markup.heading.2.markdown punctuation.definition.heading.setext.markdown +| ^ markup.heading.2.markdown meta.whitespace.newline.markdown + + Foo +----- +| <- markup.heading.2.markdown punctuation.definition.heading.setext.markdown +|^^^^ markup.heading.2.markdown punctuation.definition.heading.setext.markdown +| ^ markup.heading.2.markdown meta.whitespace.newline.markdown + + Foo + === +| <- markup.heading.1.markdown - punctuation +|^ markup.heading.1.markdown - punctuation +| ^^^ markup.heading.1.markdown punctuation.definition.heading.setext.markdown +| ^ markup.heading.1.markdown meta.whitespace.newline.markdown + +https://spec.commonmark.org/0.30/#example-85 + + Foo + --- +|^^^^^^^ markup.raw.block.markdown + + Foo +--- +| <- meta.separator.thematic-break.markdown - markup.heading +|^^^ meta.separator.thematic-break.markdown - markup.heading + +https://spec.commonmark.org/0.30/#example-86 + +Foo + ---- +|^^^^^^^^^^^^^ markup.heading.2.markdown +|^^ - punctuation +| ^^^^ punctuation.definition.heading.setext.markdown +| ^^^^^^^ - punctuation +| ^ meta.whitespace.newline.markdown + +https://spec.commonmark.org/0.30/#example-87 + +Foo + --- +| <- meta.paragraph.markdown - markup.heading +|^^^^^^^ meta.paragraph.markdown - markup.heading + +https://spec.commonmark.org/0.30/#example-88 + +Foo += = +| <- meta.paragraph.markdown - markup.heading +|^^^ meta.paragraph.markdown - markup.heading + +Foo +--- - +| <- meta.separator.thematic-break.markdown - markup.heading +|^^^^^ meta.separator.thematic-break.markdown - markup.heading + +https://spec.commonmark.org/0.30/#example-89 + +Foo +| ^^ markup.heading.2.markdown entity.name.section.markdown - meta.hard-line-break +----- +| <- markup.heading.2.markdown punctuation.definition.heading.setext.markdown +|^^^^ markup.heading.2.markdown punctuation.definition.heading.setext.markdown + +https://spec.commonmark.org/0.30/#example-90 + +Foo\ +| ^ markup.heading.2.markdown entity.name.section.markdown - meta.hard-line-break +---- +| <- markup.heading.2.markdown punctuation.definition.heading.setext.markdown +|^^^ markup.heading.2.markdown punctuation.definition.heading.setext.markdown + +https://spec.commonmark.org/0.30/#example-91 + +`Foo +---- +| <- markup.heading.2.markdown punctuation.definition.heading.setext.markdown +|^^^ markup.heading.2.markdown punctuation.definition.heading.setext.markdown + +`Foo` +---- +| <- markup.heading.2.markdown punctuation.definition.heading.setext.markdown +|^^^ markup.heading.2.markdown punctuation.definition.heading.setext.markdown + +https://spec.commonmark.org/0.30/#example-92 + +> Foo +--- +| <- meta.separator.thematic-break.markdown - markup.heading +|^^^ meta.separator.thematic-break.markdown - markup.heading + +https://spec.commonmark.org/0.30/#example-93 + +> foo +bar +=== +| <- markup.quote.markdown - markup.heading +|^^^ markup.quote.markdown - markup.heading + +https://spec.commonmark.org/0.30/#example-94 +- Foo +--- +| <- meta.separator.thematic-break.markdown - markup.heading +|^^^ meta.separator.thematic-break.markdown - markup.heading + +https://spec.commonmark.org/0.30/#example-95 + +Foo +Bar +--- +| <- markup.heading.2.markdown punctuation.definition.heading.setext.markdown +|^^ markup.heading.2.markdown punctuation.definition.heading.setext.markdown + +https://spec.commonmark.org/0.30/#example-96 + +--- +Foo +--- +| <- markup.heading.2.markdown punctuation.definition.heading.setext.markdown +|^^ markup.heading.2.markdown punctuation.definition.heading.setext.markdown + +--- +Foo +--- +Bar +--- +| <- markup.heading.2.markdown punctuation.definition.heading.setext.markdown +|^^ markup.heading.2.markdown punctuation.definition.heading.setext.markdown +Baz + +--- +Foo +--- +Bar +--- +Baz +| <- meta.paragraph.markdown +|^^^ meta.paragraph.markdown + +https://spec.commonmark.org/0.30/#example-97 + +==== +| <- meta.paragraph.markdown +|^^^^ meta.paragraph.markdown + +https://spec.commonmark.org/0.30/#example-98 + +--- +--- +| <- meta.separator.thematic-break.markdown - markup.heading +|^^^ meta.separator.thematic-break.markdown - markup.heading + +https://spec.commonmark.org/0.30/#example-102 + +\> foo +------ +| <- markup.heading.2.markdown punctuation.definition.heading.setext.markdown +|^^^^^ markup.heading.2.markdown punctuation.definition.heading.setext.markdown + +``` +Fenced codeblocks are no no setext heading +``` +--- +| <- meta.separator.thematic-break.markdown punctuation.definition.thematic-break.markdown +|^^ meta.separator.thematic-break.markdown punctuation.definition.thematic-break.markdown + + +# TEST: INDENTED CODE BLOCKS ################################################## + +Code block below: + + this is code! +| ^^^^^^^^^^^^^^^^ markup.raw.block + + more code + spanning multiple lines +| ^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.raw.block + +paragraph +| <- meta.paragraph + + +# TEST: FENCED CODE BLOCKS #################################################### + +## https://spec.commonmark.org/0.30/#example-119 + +``` +| <- meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown +|^^ meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown +| ^ meta.code-fence.definition.begin.text.markdown-gfm - punctuation +< +| <- markup.raw.code-fence.markdown-gfm - punctuation + > +|^^ markup.raw.code-fence.markdown-gfm - punctuation +``` +| <- meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +|^^ meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +| ^ meta.code-fence.definition.end.text.markdown-gfm - punctuation + +## https://spec.commonmark.org/0.30/#example-120 + +~~~ +| <- meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown +|^^ meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown +| ^ meta.code-fence.definition.begin.text.markdown-gfm - punctuation +< +| <- markup.raw.code-fence.markdown-gfm - punctuation + > +|^^ markup.raw.code-fence.markdown-gfm - punctuation +~~~ +| <- meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +|^^ meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +| ^ meta.code-fence.definition.end.text.markdown-gfm - punctuation + +## https://spec.commonmark.org/0.30/#example-121 + +`` +foo +`` +| <- - meta.code-fence - punctuation.definition.raw.code-fence +|^ - meta.code-fence - punctuation.definition.raw.code-fence + +## https://spec.commonmark.org/0.30/#example-122 + +``` +| <- meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown +|^^ meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown +| ^ meta.code-fence.definition.begin.text.markdown-gfm - punctuation +aaa +~~~ +| <- markup.raw.code-fence.markdown-gfm - punctuation +``` +| <- meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +|^^ meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +| ^ meta.code-fence.definition.end.text.markdown-gfm - punctuation + +## https://spec.commonmark.org/0.30/#example-123 + +~~~ +| <- meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown +|^^ meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown +| ^ meta.code-fence.definition.begin.text.markdown-gfm - punctuation +aaa +``` +| <- markup.raw.code-fence.markdown-gfm - punctuation +~~~ +| <- meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +|^^ meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +| ^ meta.code-fence.definition.end.text.markdown-gfm - punctuation + +~~~~ +| <- punctuation.definition.raw.code-fence.begin + ~~~~ +| ^^^ punctuation.definition.raw.code-fence.end + +## https://spec.commonmark.org/0.30/#example-124 + +```` +| <- meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown +|^^^ meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown +| ^ meta.code-fence.definition.begin.text.markdown-gfm - punctuation +aaa +``` +| <- markup.raw.code-fence.markdown-gfm - punctuation +`````` +| <- meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +|^^^^^ meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +| ^ meta.code-fence.definition.end.text.markdown-gfm - punctuation + +## https://spec.commonmark.org/0.30/#example-125 + +~~~~ +| <- meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown +|^^^ meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown +| ^ meta.code-fence.definition.begin.text.markdown-gfm - punctuation +| +aaa +~~~ +| <- markup.raw.code-fence.markdown-gfm - punctuation +~~~~ +| <- meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +|^^^ meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +| ^ meta.code-fence.definition.end.text.markdown-gfm - punctuation + +## https://spec.commonmark.org/0.30/#example-128 + +> ``` +> aaa +| <- markup.quote.markdown punctuation.definition.blockquote.markdown +|^ markup.quote.markdown - markup.raw +| ^^^^ markup.quote.markdown markup.raw.code-fence.markdown-gfm + +bbb +| <- meta.paragraph.markdown - markup.raw + +## https://spec.commonmark.org/0.30/#example-129 + +``` +| <- meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown +|^^ meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown +| ^ meta.code-fence.definition.begin.text.markdown-gfm - punctuation + + +``` +| <- meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +|^^ meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +| ^ meta.code-fence.definition.end.text.markdown-gfm - punctuation + +## https://spec.commonmark.org/0.30/#example-130 + +``` +``` +| <- meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +|^^ meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +| ^ meta.code-fence.definition.end.text.markdown-gfm - punctuation + +## https://spec.commonmark.org/0.30/#example-131 + + ``` + aaa +aaa +``` +| <- meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +|^^ meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +| ^ meta.code-fence.definition.end.text.markdown-gfm - punctuation + +## https://spec.commonmark.org/0.30/#example-132 + + ``` +aaa + aaa +aaa + ``` +| <- meta.code-fence.definition.end.text.markdown-gfm - punctuation +|^ meta.code-fence.definition.end.text.markdown-gfm - punctuation +| ^^^ meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +| ^ meta.code-fence.definition.end.text.markdown-gfm - punctuation + +## https://spec.commonmark.org/0.30/#example-133 + + ``` + aaa + aaa + aaa + ``` +| <- meta.code-fence.definition.end.text.markdown-gfm - punctuation +|^^ meta.code-fence.definition.end.text.markdown-gfm - punctuation +| ^^^ meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +| ^ meta.code-fence.definition.end.text.markdown-gfm - punctuation + +## https://spec.commonmark.org/0.30/#example-134 + + ``` + aaa + ``` +| <- markup.raw.block.markdown +|^^^^^^^ markup.raw.block.markdown - punctuation + +## https://spec.commonmark.org/0.30/#example-135 + +``` +| <- meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown +|^^ meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown +| ^ meta.code-fence.definition.begin.text.markdown-gfm - punctuation +aaa +| <- markup.raw.code-fence.markdown-gfm + ``` +| <- meta.code-fence.definition.end.text.markdown-gfm - punctuation +|^ meta.code-fence.definition.end.text.markdown-gfm - punctuation +| ^^^ meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +| ^ meta.code-fence.definition.end.text.markdown-gfm - punctuation + +## https://spec.commonmark.org/0.30/#example-136 + + ``` +| <- meta.code-fence.definition.begin.text.markdown-gfm - punctuation +|^^ meta.code-fence.definition.begin.text.markdown-gfm - punctuation +| ^^^ meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown +| ^ meta.code-fence.definition.begin.text.markdown-gfm - punctuation +aaa +| <- markup.raw.code-fence.markdown-gfm + ``` +| <- meta.code-fence.definition.end.text.markdown-gfm - punctuation +|^ meta.code-fence.definition.end.text.markdown-gfm - punctuation +| ^^^ meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +| ^ meta.code-fence.definition.end.text.markdown-gfm - punctuation + +## https://spec.commonmark.org/0.30/#example-137 + +``` +| <- meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown +|^^ meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown +| ^ meta.code-fence.definition.begin.text.markdown-gfm - punctuation +aaa +| <- markup.raw.code-fence.markdown-gfm + ``` +| <- meta.code-fence.definition.end.text.markdown-gfm - punctuation +|^^^ meta.code-fence.definition.end.text.markdown-gfm - punctuation +| ^^^ meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +| ^ meta.code-fence.definition.end.text.markdown-gfm - punctuation + +## https://spec.commonmark.org/0.30/#example-138 + +``` ``` +| <- markup.raw.inline.markdown punctuation.definition.raw.begin.markdown +|^^^^^^ markup.raw.inline.markdown + +``` ``` +aaa +| <- meta.paragraph.markdown - meta.code-fence - markup +|^^ meta.paragraph.markdown - meta.code-fence - markup + +## https://spec.commonmark.org/0.30/#example-139 + +~~~~~~ +aaa +~~~ ~~ +| <- markup.raw.code-fence.markdown-gfm - punctuation +|^^^^^^ markup.raw.code-fence.markdown-gfm - punctuation + +~~~~~~ +| <- meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +|^^^^^ meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +| ^ meta.code-fence.definition.end.text.markdown-gfm - punctuation + +## https://spec.commonmark.org/0.30/#example-140 + +foo +``` +| <- meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown +|^^ meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown +| ^ meta.code-fence.definition.begin.text.markdown-gfm - punctuation +bar +``` +baz +| <- meta.paragraph.markdown - meta.code-fence - markup +|^^ meta.paragraph.markdown - meta.code-fence - markup + +## https://spec.commonmark.org/0.30/#example-140-including-emphasis-termination + +Paragraph is terminated by fenced code blocks. +``` +| <- meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown +``` +| <- meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown + +Code blocks terminate **bold text +``` +| <- meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown +``` +| <- meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +this must not be bold** +| <- - meta.bold +|^^^^^^^^^^^^^^^^^^^^^^^ - meta.bold + +Code blocks terminate __bold text +``` +| <- meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown +``` +| <- meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +this must not be bold__ +| <- - meta.bold +|^^^^^^^^^^^^^^^^^^^^^^^ - meta.bold + +Code blocks terminate *italic text +``` +| <- meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown +``` +| <- meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +this must not be italic* +| <- - meta.italic +|^^^^^^^^^^^^^^^^^^^^^^^ - meta.italic + +Code blocks terminate _italic text +``` +| <- meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown +``` +| <- meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +this must not be italic_ +| <- - meta.italic +|^^^^^^^^^^^^^^^^^^^^^^^ - meta.bold - meta.italic + +Code blocks terminate ***bold italic text +``` +| <- meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown +``` +| <- meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +this must not be bold italic*** +| <- - meta.bold - meta.italic +|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.bold - meta.italic + +Code blocks terminate ___bold italic text +``` +| <- meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown +``` +| <- meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +this must not be bold italic___ +| <- - meta.bold - meta.italic +|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.bold - meta.italic + +Code blocks terminate **_bold italic text +``` +| <- meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown +``` +| <- meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +this must not be bold italic_** +| <- - meta.bold - meta.italic +|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.bold - meta.italic + +## https://spec.commonmark.org/0.30/#example-141 + +foo +--- +~~~ +| <- meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown +|^^ meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown +| ^ meta.code-fence.definition.begin.text.markdown-gfm - punctuation +bar +|^^^ markup.raw.code-fence.markdown-gfm +~~~ +# baz +| <- markup.heading.1.markdown punctuation.definition.heading.begin.markdown +|^^^^^ markup.heading.1.markdown + +## https://spec.commonmark.org/0.30/#example-142 + +```ruby +| <- meta.code-fence.definition.begin.ruby.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown +|^^ meta.code-fence.definition.begin.ruby.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown +| ^^^^ meta.code-fence.definition.begin.ruby.markdown-gfm constant.other.language-name.markdown +| ^ meta.code-fence.definition.begin.ruby.markdown-gfm - constant +def foo(x) +| <- markup.raw.code-fence.ruby.markdown-gfm source.ruby meta.function + return 3 +end +| <- markup.raw.code-fence.ruby.markdown-gfm source.ruby keyword +``` +| <- meta.code-fence.definition.end.ruby.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +|^^ meta.code-fence.definition.end.ruby.markdown-gfm punctuation.definition.raw.code-fence.end.markdown + +## https://spec.commonmark.org/0.30/#example-143 + +~~~~ ruby startline=3 $%@#$ +| <- meta.code-fence.definition.begin.ruby.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown +|^^^ meta.code-fence.definition.begin.ruby.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown +| ^^^^ meta.code-fence.definition.begin.ruby.markdown-gfm - punctuation - constant +| ^^^^ meta.code-fence.definition.begin.ruby.markdown-gfm constant.other.language-name.markdown +| ^^^^^^^^^^^^^^^^^^^ meta.code-fence.definition.begin.ruby.markdown-gfm - constant +def foo(x) +| <- markup.raw.code-fence.ruby.markdown-gfm source.ruby meta.function + return 3 +end +| <- markup.raw.code-fence.ruby.markdown-gfm source.ruby keyword +~~~~~~~ +| <- meta.code-fence.definition.end.ruby.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +|^^^^^^ meta.code-fence.definition.end.ruby.markdown-gfm punctuation.definition.raw.code-fence.end.markdown + +## https://spec.commonmark.org/0.30/#example-144 + +````; +| <- meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown +|^^^ meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown +| ^^ meta.code-fence.definition.begin.text.markdown-gfm +```` +| <- meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +|^^^ meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown + +## https://spec.commonmark.org/0.30/#example-145 + +``` aa ``` +| <- markup.raw.inline.markdown punctuation.definition.raw.begin.markdown +|^^^^^^^^^ meta.paragraph.markdown markup.raw.inline.markdown +|^^ punctuation.definition.raw.begin.markdown +| ^^^ punctuation.definition.raw.end.markdown +foo +| <- meta.paragraph.markdown - markup + +## https://spec.commonmark.org/0.30/#example-146 + +~~~ aa ``` ~~~ +| <- meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown +|^^ meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown +| ^^ meta.code-fence.definition.begin.text.markdown-gfm constant.other.language-name.markdown +| ^^^^^^^^^ meta.code-fence.definition.begin.text.markdown-gfm - punctuation +foo +~~~ +| <- meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +|^^ meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown + +~~~~~foo~ +|^^^^ meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown +| ^^^^ meta.code-fence.definition.begin.text.markdown-gfm constant.other.language-name.markdown + +~~~~~ +|^^^^ meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown + +## https://spec.commonmark.org/0.30/#example-147 + +``` +| <- meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown +|^^ meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown +``` aaa +| <- markup.raw.code-fence.markdown-gfm - punctuation +``` +| <- meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +|^^ meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown + +## https://fenced-code-block-embedded-syntaxes-tests + +```bash +# test +| ^^^^^ source.shell comment.line.number-sign +echo hello, \ +| ^^ punctuation.separator.continuation.line +echo This is a smiley :-\) \(I have to escape the parentheses, though!\) +| ^^ constant.character.escape +``` +| <- meta.code-fence.definition.end.shell-script punctuation.definition.raw.code-fence.end +|^^ meta.code-fence.definition.end.shell-script.markdown-gfm punctuation.definition.raw.code-fence.end.markdown + +```clojure +|^^^^^^^^^ meta.code-fence.definition.begin.clojure +| ^^^^^^^ constant.other.language-name + (/ 10 3.0) +| <- source.clojure +|^^^^^^^^^^ source.clojure +``` +| <- meta.code-fence.definition.end.clojure.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +|^^ meta.code-fence.definition.end.clojure.markdown-gfm punctuation.definition.raw.code-fence.end.markdown + +```cmd + +| <- markup.raw.code-fence.dosbatch.markdown-gfm source.dosbatch +``` +| <- meta.code-fence.definition.end.dosbatch.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +|^^ meta.code-fence.definition.end.dosbatch.markdown-gfm punctuation.definition.raw.code-fence.end.markdown + +```css + +| <- markup.raw.code-fence.css.markdown-gfm source.css +``` +| <- meta.code-fence.definition.end.css.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +|^^ meta.code-fence.definition.end.css.markdown-gfm punctuation.definition.raw.code-fence.end.markdown + +```diff ++ inserted +| <- source.diff markup.inserted.diff punctuation.definition.inserted.diff +- deleted +| <- source.diff markup.deleted.diff punctuation.definition.deleted.diff +``` +| <- meta.code-fence.definition.end.diff.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +|^^ meta.code-fence.definition.end.diff.markdown-gfm punctuation.definition.raw.code-fence.end.markdown + +```Graphviz +graph n {} +| ^^^ storage.type.dot +``` +| <- meta.code-fence.definition.end.graphviz.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +|^^ meta.code-fence.definition.end.graphviz.markdown-gfm punctuation.definition.raw.code-fence.end.markdown + +```haskell + +| <- markup.raw.code-fence.haskell.markdown-gfm source.haskell +``` +| <- meta.code-fence.definition.end.haskell.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +|^^ meta.code-fence.definition.end.haskell.markdown-gfm punctuation.definition.raw.code-fence.end.markdown + +```html + +| <- markup.raw.code-fence.html.markdown-gfm text.html +| ^^^^^^ text.html meta.tag +``` +| <- meta.code-fence.definition.end.html.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +|^^ meta.code-fence.definition.end.html.markdown-gfm punctuation.definition.raw.code-fence.end.markdown + +```html+php +
+|^^^ entity.name.tag.block.any.html + /foo/ +| <- markup.raw.code-fence.shell.markdown-gfm source.shell.interactive.markdown comment.other.shell +|^^^^^^^ markup.raw.code-fence.shell.markdown-gfm source.shell.interactive.markdown + +$ ls \ +> /foo/ +bar +| <- markup.raw.code-fence.shell.markdown-gfm source.shell.interactive.markdown - meta.function-call +|^^^ markup.raw.code-fence.shell.markdown-gfm source.shell.interactive.markdown - meta.function-call + +function foo () {} +| <- markup.raw.code-fence.shell.markdown-gfm source.shell.interactive.markdown - meta.function +|^^^^^^^^^^^^^^^^^^ markup.raw.code-fence.shell.markdown-gfm source.shell.interactive.markdown - meta.function +``` +| <- meta.code-fence.definition.end.shell.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +|^^ meta.code-fence.definition.end.shell.markdown-gfm punctuation.definition.raw.code-fence.end.markdown + + ```shell + $ ls +| ^^^^^ markup.raw.code-fence.shell.markdown-gfm source.shell.interactive.markdown +| ^ comment.other.shell +| ^^ meta.function-call.identifier.shell variable.function.shell + ``` + +```shell-script + +| <- markup.raw.code-fence.shell-script.markdown-gfm source.shell.bash +``` +| <- meta.code-fence.definition.end.shell-script.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +|^^ meta.code-fence.definition.end.shell-script.markdown-gfm punctuation.definition.raw.code-fence.end.markdown + +```sql +|^^^^^ meta.code-fence.definition.begin.sql +| ^^^ constant.other.language-name +SELECT TOP 10 * +|^^^^^^^^^^^^^^^ markup.raw.code-fence.sql source.sql +FROM TableName +``` +| <- meta.code-fence.definition.end.sql.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +|^^ meta.code-fence.definition.end.sql.markdown-gfm punctuation.definition.raw.code-fence.end.markdown + +```ts +declare type foo = 'bar' +| <- markup.raw.code-fence.typescript.markdown-gfm source.ts +``` +| <- meta.code-fence.definition.end.typescript.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +|^^ meta.code-fence.definition.end.typescript.markdown-gfm punctuation.definition.raw.code-fence.end.markdown + +```tsx + +| <- markup.raw.code-fence.tsx.markdown-gfm +``` +| <- meta.code-fence.definition.end.tsx.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +|^^ meta.code-fence.definition.end.tsx.markdown-gfm punctuation.definition.raw.code-fence.end.markdown + +```xml +|^^^^^ meta.code-fence.definition.begin.xml +| ^^^ constant.other.language-name + +|^^^^^^^^^^^^^^^^^^^^^^ markup.raw.code-fence.xml +| ^^^^^^^ meta.tag.preprocessor.xml entity.other.attribute-name.localname.xml + + + +``` +| <- meta.code-fence.definition.end.xml.markdown-gfm punctuation.definition.raw.code-fence.end.markdown +|^^ meta.code-fence.definition.end.xml.markdown-gfm punctuation.definition.raw.code-fence.end.markdown + +```R%&?! weired language name +|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.code-fence.definition.begin.text.markdown-gfm +| ^^^^^ constant.other.language-name.markdown +| ^^^^^^^^^^^^^^^^^^^^^ - constant +``` + +```{key: value} +|^^^^^^^^^^^^^^^ meta.code-fence.definition.begin.text.markdown-gfm +| ^^^^^^^^^^^^ - constant +``` + +``` {key: value} +|^^^^^^^^^^^^^^^^ meta.code-fence.definition.begin.text.markdown-gfm +| ^^^^^^^^^^^^ - constant +``` + + +# TEST: HTML BLOCKS ########################################################### + +## https://spec.commonmark.org/0.30/#example-148 + +
+
+**Hello**,
+| ^^^^^^^^^ meta.disable-markdown - markup
+
+_world_.
+| ^^^^ markup.italic - meta.disable-markdown
+
+
+ +## https://spec.commonmark.org/0.30/#example-149 + + + + + +
+ hi +|^^^^^^^^^^^^^ meta.disable-markdown +
+ +okay. +| <- meta.paragraph.markdown +|^^^^^ meta.paragraph.markdown + +## https://spec.commonmark.org/0.30/#example-150 + +
+*foo* +| <- meta.disable-markdown - markup.italic +|^^^^^ meta.disable-markdown - markup.italic + +## https://spec.commonmark.org/0.30/#example-152 + +
+| ^^^^^^^^^^^^^^^^ meta.disable-markdown + +*Markdown* +| ^^^^^^^ meta.paragraph markup.italic - meta.disable-markdown + +
+| ^^^ meta.disable-markdown meta.tag.block.any.html + +## https://spec.commonmark.org/0.30/#example-153 + +
+|^^^^^^^^^^^^^ meta.disable-markdown meta.tag.block +
+|^^^^^ meta.disable-markdown meta.tag.block + +## https://spec.commonmark.org/0.30/#example-154 + +
+|^^^^^^ meta.disable-markdown meta.tag.block +
+|^^^^^ meta.disable-markdown meta.tag.block + +## https://spec.commonmark.org/0.30/#example-155 + +
+*foo* +| <- meta.disable-markdown - markup.italic + +
+*foo* + +*bar* +| <- meta.paragraph.markdown markup.italic.markdown punctuation.definition.italic.begin.markdown + +## https://spec.commonmark.org/0.30/#example-159 + + +| ^^^^^ meta.disable-markdown - markup.italic + +## https://spec.commonmark.org/0.30/#example-161 + +
+``` c +int x = 33; +``` +|^^^ meta.disable-markdown + +## https://spec.commonmark.org/0.30/#example-162 + + +*bar* +| <- meta.disable-markdown - markup.italic - punctuation +|^^^^^ meta.disable-markdown - markup.italic + + +## https://spec.commonmark.org/0.30/#example-163 + + +*bar* +| <- meta.disable-markdown - markup.italic - punctuation +|^^^^^ meta.disable-markdown - markup.italic + +| ^^^^^^^ meta.disable-markdown meta.tag.other.html entity.name.tag.other.html + +## https://spec.commonmark.org/0.30/#example-164 + + +*bar* +| <- meta.disable-markdown - markup.italic - punctuation +|^^^^^ meta.disable-markdown - markup.italic + +| <- meta.disable-markdown meta.tag punctuation.definition.tag +|^^^ meta.disable-markdown meta.tag +| ^ meta.disable-markdown - meta.tag + +## https://spec.commonmark.org/0.30/#example-165 + + +*bar* +| <- meta.disable-markdown - markup.italic - punctuation +|^^^^^ meta.disable-markdown - markup.italic + +## https://spec.commonmark.org/0.30/#example-166 + + +*foo* +| <- meta.disable-markdown - markup.italic - punctuation +|^^^^^ meta.disable-markdown - markup.italic + +| <- meta.disable-markdown meta.tag punctuation.definition.tag +|^^^^^ meta.disable-markdown meta.tag +| ^ meta.disable-markdown - meta.tag + +## https://spec.commonmark.org/0.30/#example-167 + + +| <- meta.disable-markdown meta.tag punctuation.definition.tag +|^^^^ meta.disable-markdown meta.tag +| ^ meta.disable-markdown - meta.tag + +*foo* +| <- meta.paragraph.markdown markup.italic.markdown punctuation.definition.italic.begin.markdown +|^^^ meta.paragraph.markdown markup.italic.markdown - punctuation +| ^ meta.paragraph.markdown markup.italic.markdown punctuation.definition.italic.end.markdown + + +| <- meta.disable-markdown meta.tag punctuation.definition.tag +|^^^^^ meta.disable-markdown meta.tag +| ^ meta.disable-markdown - meta.tag + +## https://spec.commonmark.org/0.30/#example-168 + +*foo* +|^^^^^^^^^^^^^^^ meta.paragraph - meta.disable-markdown +|^^^^ meta.tag.inline +| ^^^^^ markup.italic +| ^^^^^^ meta.tag.inline + +## https://spec.commonmark.org/0.30/#example-169 + +

+| ^^ meta.disable-markdown meta.tag.block.any.html entity.name.tag.block.any.html
+import Text.HTML.TagSoup
+
+main :: IO ()
+| ^^^^^^^^^^^^ meta.disable-markdown
+main = print $ parseTags tags
+
+| ^^^^^^^^^^^ meta.disable-markdown +| ^^^ meta.tag.block.any.html entity.name.tag.block.any.html +okay +| <- - meta.disable-markdown + +## https://spec.commonmark.org/0.30/#example-170 + + +| ^^^^^^ meta.disable-markdown meta.tag.script.end.html entity.name.tag.script.html +okay +| <- - meta.disable-markdown + +## https://spec.commonmark.org/0.30/#example-171 + + +| ^^^^^ meta.disable-markdown meta.tag.style.end.html entity.name.tag.style.html +okay +| <- - meta.disable-markdown + +## https://spec.commonmark.org/0.30/#example-172 + + +okay +| <- - meta.disable-markdown + +## https://spec.commonmark.org/0.30/#example-174 + +>
+> foo + +bar +| <- - meta.disable-markdown + +## https://spec.commonmark.org/0.30/#example-175 + +-
+- foo +| <- markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown +|^^^^^ markup.list.unnumbered.markdown + +## https://spec.commonmark.org/0.30/#example-176 + + +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.disable-markdown +*foo* +| <- - meta.disable-markdown + +## https://spec.commonmark.org/0.30/#example-177 + +*bar* +| ^^^^^^^^^^ comment.block.html +| ^^^^^ meta.disable-markdown +*baz* +| <- - meta.disable-markdown + +## https://spec.commonmark.org/0.30/#example-178 + +1. *bar* +| ^^^^^^^^^^^^^^^^ meta.disable-markdown +okay +| <- - meta.disable-markdown + +## https://spec.commonmark.org/0.30/#example-179 + + +| ^^^^^^^^ meta.disable-markdown comment.block.html +okay +| <- - meta.disable-markdown + +## https://spec.commonmark.org/0.30/#example-180 + +'; + +?> +|^^ meta.disable-markdown +okay +| <- - meta.disable-markdown + +## https://spec.commonmark.org/0.30/#example-181 + + +| ^^^^^^^ meta.disable-markdown meta.tag.sgml.doctype.html +okay +| <- - meta.disable-markdown + + +| ^^^^^^^^^^^^^ meta.disable-markdown +okay +| <- - meta.disable-markdown + +## https://spec.commonmark.org/0.30/#example-182 + + +|^^ meta.disable-markdown meta.tag.sgml +okay +| <- - meta.disable-markdown + +## https://spec.commonmark.org/0.30/#example-183 + + +| ^^^^^^^^^^^^ meta.disable-markdown comment.block.html + + +|^^^^^^^^^^^^^^^^ markup.raw.block.markdown + +## https://spec.commonmark.org/0.30/#example-184 + +
+ +
+|^^^^^^^^^ markup.raw.block.markdown + +## https://spec.commonmark.org/0.30/#example-188 + +
+ +*Emphasized* text. +|^^^^^^^^^^^^^^^^^^ meta.paragraph.markdown +| <- markup.italic.markdown punctuation.definition.italic.begin.markdown +|^^^^^^^^^^^ markup.italic.markdown + +
+| <- meta.disable-markdown meta.tag.block +|^^^^^ meta.disable-markdown meta.tag.block + +## https://spec.commonmark.org/0.30/#example-189 + +
+*Emphasized* text. +| <- meta.disable-markdown - markup.italic +|^^^^^^^^^^^^^^^^^^ meta.disable-markdown - markup.italic +
+| <- meta.disable-markdown meta.tag.block +|^^^^^ meta.disable-markdown meta.tag.block + +## https://spec.commonmark.org/0.30/#example-190 + + +| <- meta.disable-markdown meta.tag +|^^^^^^ meta.disable-markdown meta.tag + + +| <- meta.disable-markdown meta.tag +|^^^ meta.disable-markdown meta.tag + + +| <- meta.disable-markdown meta.tag +|^^^^ meta.disable-markdown meta.tag + + +| <- meta.disable-markdown meta.tag +|^^^^ meta.disable-markdown meta.tag + +
+Hi +
+| <- meta.disable-markdown meta.tag +|^^^^^^^ meta.disable-markdown meta.tag + +## https://spec.commonmark.org/0.30/#example-191 + + +| <- meta.disable-markdown meta.tag +|^^^^^^ meta.disable-markdown meta.tag + + +| <- meta.disable-markdown +|^^^^^^^ meta.disable-markdown + + +| <- markup.raw.block.markdown +|^^^^^^^^^ markup.raw.block.markdown + + +| <- meta.disable-markdown +|^^^^^^^ meta.disable-markdown + +
+ Hi +
+| <- meta.disable-markdown meta.tag +|^^^^^^^ meta.disable-markdown meta.tag + +## https://custom-tests/html-blocks + +
this is HTML until there are two blank lines
+| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.disable-markdown +disabled markdown +| <- meta.disable-markdown + +non-disabled markdown +| <- - meta.disable-markdown + +
this is HTML until there are two blank lines +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.disable-markdown +still HTML +| ^^^^ meta.tag.inline.any.html entity.name.tag.inline.any.html +
+| ^^^^ meta.disable-markdown + +non-disabled markdown +| <- - meta.disable-markdown + +
nested tags don't count 
test
+| ^^^^^^ meta.disable-markdown meta.tag.block.any.html +non-disabled markdown +| <- - meta.disable-markdown + +
nested tags don't count
test +| ^^^^^ meta.disable-markdown +
+| ^^^ meta.disable-markdown entity.name.tag.block.any.html + +non-disabled markdown +| <- - meta.disable-markdown + +
two blank lines needed
to stop disabled markdown +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.disable-markdown +disabled markdown +| <- meta.disable-markdown + +non-disabled markdown +| <- - meta.disable-markdown + +
another
disable test +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.disable-markdown +| ^^^^^^ meta.tag.inline.any.html +disabled markdown +| <- meta.disable-markdown + +non-disabled markdown +| <- - meta.disable-markdown + +*a* +| ^ markup.italic +

*a*

+| ^^^^^^^^^ meta.disable-markdown - markup.italic +*a* +| ^^ meta.disable-markdown + +non-disabled markdown +| <- - meta.disable-markdown + + +# TEST: LINK REFERENCE DEFINITIONS ############################################ + +## https://spec.commonmark.org/0.30/#example-192 + +[foo]: /url "title" +|^^^^^^^^^^^^^^^^^^ meta.link.reference.def.markdown +| ^ punctuation.separator.key-value +| ^^^^ markup.underline.link +| ^^^^^^^ string.quoted.double + +## https://spec.commonmark.org/0.30/#example-193 + + [foo]: + /url + 'the title' +|^^^^^^^^^^^^^^^^^^^^^^^ meta.link.reference.def.markdown +| ^^^^^^^^^^^ string.quoted.single + +## https://spec.commonmark.org/0.30/#example-194 + + [Foo*bar\]]:my_(url) 'title (with parens)' +|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.reference.def.markdown +|^ punctuation.definition.reference.begin.markdown +| ^^^^^^^^^ entity.name.reference.link.markdown - punctuation +| ^ punctuation.definition.reference.end.markdown +| ^ punctuation.separator.key-value.markdown +| ^^^^^^^^ markup.underline.link +| ^ - markup - string +| ^^^^^^^^^^^^^^^^^^^^^ string.quoted.single + +## https://spec.commonmark.org/0.30/#example-195 + +[Foo bar]: + +| <- meta.link.reference.def.markdown punctuation.definition.link.begin.markdown +|^^^^^^ meta.link.reference.def.markdown markup.underline.link.markdown +| ^ meta.link.reference.def.markdown punctuation.definition.link.end.markdown + +[Foo bar]: + +'title' +| <- meta.link.reference.def.markdown meta.string.title.markdown string.quoted.single.markdown +|^^^^^^ meta.link.reference.def.markdown meta.string.title.markdown string.quoted.single.markdown + +## https://spec.commonmark.org/0.30/#example-196 + +[foo]: /url ' +| ^ meta.link.reference.def.markdown meta.string.title.markdown string.quoted.single.markdown punctuation.definition.string.begin.markdown +title +| <- meta.link.reference.def.markdown meta.string.title.markdown string.quoted.single.markdown +|^^^^^ meta.link.reference.def.markdown meta.string.title.markdown string.quoted.single.markdown +line1 +| <- meta.link.reference.def.markdown meta.string.title.markdown string.quoted.single.markdown +|^^^^^ meta.link.reference.def.markdown meta.string.title.markdown string.quoted.single.markdown +line2 +| <- meta.link.reference.def.markdown meta.string.title.markdown string.quoted.single.markdown +|^^^^^ meta.link.reference.def.markdown meta.string.title.markdown string.quoted.single.markdown +' +| <- meta.link.reference.def.markdown meta.string.title.markdown string.quoted.single.markdown punctuation.definition.string.end.markdown + +## https://spec.commonmark.org/0.30/#example-197 + +[foo]: /url 'title + +with blank line' +| <- meta.paragraph.markdown - meta.link +|^^^^^^^^^^^^^^^ meta.paragraph.markdown - meta.link + +## https://spec.commonmark.org/0.30/#example-198 + +[foo]: +/url +| <- meta.link.reference.def.markdown markup.underline.link.markdown punctuation.separator.path.markdown +|^^^ meta.link.reference.def.markdown markup.underline.link.markdown + +## https://spec.commonmark.org/0.30/#example-199 + +[foo]: +| <- meta.link.reference.def.markdown punctuation.definition.reference.begin.markdown +|^^^ meta.link.reference.def.markdown entity.name.reference.link.markdown +| ^ meta.link.reference.def.markdown punctuation.definition.reference.end.markdown +| ^ meta.link.reference.def.markdown punctuation.separator.key-value.markdown +| ^ meta.link.reference.def.markdown - punctuation + +## https://spec.commonmark.org/0.30/#example-200 + +[foo]: <> +|^^^^^^^^ meta.link.reference.def.markdown +| ^ punctuation.separator.key-value +| ^ punctuation.definition.link.begin +| ^ punctuation.definition.link.end + +## https://spec.commonmark.org/0.30/#example-201 + +[foo]: (baz) +| <- meta.link.reference.def.markdown punctuation.definition.reference.begin.markdown +|^^^^^^^^^^^^^^^^ meta.link.reference.def.markdown +|^^^ entity.name.reference.link.markdown +| ^ punctuation.definition.reference.end.markdown +| ^ punctuation.separator.key-value.markdown +| ^ punctuation.definition.link.begin.markdown +| ^^^ markup.underline.link.markdown +| ^ punctuation.definition.link.end.markdown +| ^^^^^ meta.string.title.markdown string.quoted.other.markdown +| ^ punctuation.definition.string.begin.markdown +| ^ punctuation.definition.string.end.markdown + +## https://spec.commonmark.org/0.30/#example-202 + +[foo]: /url\bar\*baz "foo\"bar\baz" +| <- meta.link.reference.def.markdown punctuation.definition.reference.begin.markdown +|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.reference.def.markdown +|^^^ entity.name.reference.link.markdown +| ^ punctuation.definition.reference.end.markdown +| ^ punctuation.separator.key-value.markdown +| ^^^^^^^^^^^^^ markup.underline.link.markdown +| ^ punctuation.separator.path.markdown +| ^^ - constant.character.escape +| ^^ constant.character.escape.markdown +| ^^^^^^^^^^^^^^ meta.string.title.markdown string.quoted.double.markdown +| ^ punctuation.definition.string.begin.markdown +| ^^ constant.character.escape.markdown +| ^^ - constant.character.escape +| ^ punctuation.definition.string.end.markdown + +## https://spec.commonmark.org/0.30/#example-203 + +[foo]: url +| <- meta.link.reference.def.markdown punctuation.definition.reference.begin.markdown +|^^^^^^^^^ meta.link.reference.def.markdown +|^^^ entity.name.reference.link.markdown +| ^ punctuation.definition.reference.end.markdown +| ^ punctuation.separator.key-value.markdown +| ^^^ markup.underline.link.markdown + +## https://spec.commonmark.org/0.30/#example-204 + +[foo]: first +[foo]: second +| <- meta.link.reference.def.markdown punctuation.definition.reference.begin.markdown +|^^^^^^^^^^^^ meta.link.reference.def.markdown +|^^^ entity.name.reference.link.markdown +| ^ punctuation.definition.reference.end.markdown +| ^ punctuation.separator.key-value.markdown +| ^^^^^^ markup.underline.link.markdown + +## https://spec.commonmark.org/0.30/#example-205 + +[FOO]: /url +| <- meta.link.reference.def.markdown punctuation.definition.reference.begin.markdown +|^^^^^^^^^^ meta.link.reference.def.markdown +|^^^ entity.name.reference.link.markdown +| ^ punctuation.definition.reference.end.markdown +| ^ punctuation.separator.key-value.markdown +| ^^^^ markup.underline.link.markdown + +## https://spec.commonmark.org/0.30/#example-206 + +[ΑΓΩ]: /φου +| <- meta.link.reference.def.markdown punctuation.definition.reference.begin.markdown +|^^^^^^^^^^ meta.link.reference.def.markdown +|^^^ entity.name.reference.link.markdown +| ^ punctuation.definition.reference.end.markdown +| ^ punctuation.separator.key-value.markdown +| ^^^^ markup.underline.link.markdown + +## https://spec.commonmark.org/0.30/#example-208 + +[ +foo +]: /url +bar +| <- meta.paragraph.markdown - meta.link +|^^^ meta.paragraph.markdown - meta.link + +## https://spec.commonmark.org/0.30/#example-209 + +This is not a link reference definition, because there are characters other than spaces or tabs after the title: + +[foo]: /url "title" ok +|^^^^^^^^^^^^^^^^^^^^^ meta.link.reference.def.markdown +| ^^ invalid.illegal.expected-eol.markdown + +## https://spec.commonmark.org/0.30/#example-210 + +This is a link reference definition, but it has no title: + +[foo]: /url +"title" ok +|^^^^^^^^^ meta.link.reference.def.markdown +| ^^ invalid.illegal.expected-eol.markdown + +[foo]: "baz" +|^^^^^^^^^^^^^^^^^^ meta.link.reference.def.markdown +| ^ punctuation.definition.link.begin +| ^^^ markup.underline.link +| ^ punctuation.definition.link.end +| ^^^^^ string.quoted.double +| ^ - invalid.illegal.expected-eol + +[foo]: > "baz" +|^^^^^^^^^^^^^^^^^^ meta.link.reference.def.markdown +| ^ punctuation.definition.link.begin +| ^^^ markup.underline.link +| ^ punctuation.definition.link.end +| ^^^^^^^ invalid.illegal.expected-eol.markdown + +## https://spec.commonmark.org/0.30/#example-211 + +This is not a link reference definition, because it is indented four spaces: + + [foo]: /url "title" +|^^^^^^^^^^^^^^^^^^^^^^^ markup.raw.block.markdown - meta.link + +## https://spec.commonmark.org/0.30/#example-212 + +This is not a link reference definition, because it occurs inside a code block: + +``` +[foo]: /url +| <- markup.raw.code-fence.markdown-gfm - meta.link +|^^^^^^^^^^^ markup.raw.code-fence.markdown-gfm - meta.link +``` + +## https://spec.commonmark.org/0.30/#example-213 + +A link reference definition cannot interrupt a paragraph. + +Foo +[bar]: /baz +| <- meta.paragraph.markdown meta.link.reference.description.markdown punctuation.definition.link.begin.markdown +|^^^^^^^^^^^ meta.paragraph.markdown +|^^^^ meta.link.reference.description.markdown +| ^^^^^^^ - punctuation - markup.underline + +## https://spec.commonmark.org/0.30/#example-214 + +### [Foo] +[foo]: /url +| <- meta.link.reference.def.markdown punctuation.definition.reference.begin.markdown +|^^^^^^^^^^^ meta.link.reference.def.markdown + +### [Foo] +[foo]: /url +> bar +| <- markup.quote.markdown punctuation.definition.blockquote.markdown +|^^^^^ markup.quote.markdown + +## https://spec.commonmark.org/0.30/#example-218 + +> [foo]: /url +| <- markup.quote.markdown punctuation.definition.blockquote.markdown +|^ markup.quote.markdown - meta.link +| ^^^^^^^^^^^^ markup.quote.markdown meta.link.reference.def.markdown +| ^ punctuation.definition.reference.begin.markdown +| ^^^ entity.name.reference.link.markdown +| ^ punctuation.definition.reference.end.markdown +| ^ punctuation.separator.key-value.markdown +| ^^^^ markup.underline.link.markdown + +## https://custom-tests/link-reference-definitions/in-block-quotes + +> [foo]: /url "description" +| <- markup.quote.markdown punctuation.definition.blockquote.markdown +|^ markup.quote.markdown - meta.link +| ^^^^^^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown meta.link.reference.def.markdown +| ^ punctuation.definition.reference.begin.markdown +| ^^^ entity.name.reference.link.markdown +| ^ punctuation.definition.reference.end.markdown +| ^ punctuation.separator.key-value.markdown +| ^^^^ markup.underline.link.markdown +| ^^^^^^^^^^^^^ meta.string.title.markdown string.quoted.double.markdown + +> [foo]: +> /url +| <- markup.quote.markdown punctuation.definition.blockquote.markdown +|^ markup.quote.markdown meta.link.reference.def.markdown - markup.underline +| ^^^^ markup.quote.markdown meta.link.reference.def.markdown markup.underline.link.markdown + +> [foo]: +> /url +> "description" +| <- markup.quote.markdown punctuation.definition.blockquote.markdown +|^ markup.quote.markdown meta.link.reference.def.markdown - meta.string - string +| ^^^^^^^^^^^^^ markup.quote.markdown meta.link.reference.def.markdown meta.string.title.markdown string.quoted.double.markdown + +> [foo]: +> -continuation> +| <- markup.quote.markdown meta.link.reference.def.markdown markup.underline.link.markdown punctuation.definition.blockquote.markdown +|^^^^^^^^^^^^^^^^ markup.quote.markdown meta.link.reference.def.markdown +|^^^^^^^^^^^^^^ markup.underline.link.markdown +| ^ punctuation.definition.link.end.markdown + +> [foo]: + /url +| <- markup.quote.markdown - markup.underline - punctuation +|^ markup.quote.markdown meta.link.reference.def.markdown - markup.underline +| ^^^^ markup.quote.markdown meta.link.reference.def.markdown markup.underline.link.markdown + +> [foo]: + /url + "description" +| <- markup.quote.markdown - meta.string - string - punctuation +|^ markup.quote.markdown meta.link.reference.def.markdown - meta.string - string +| ^^^^^^^^^^^^^ markup.quote.markdown meta.link.reference.def.markdown meta.string.title.markdown string.quoted.double.markdown + +> [foo]: + +| <- markup.quote.markdown meta.link.reference.def.markdown markup.underline.link.markdown +|^^^^^^^^^^^^^^^^ markup.quote.markdown meta.link.reference.def.markdown +|^^^^^^^^^^^^^^ markup.underline.link.markdown +| ^ punctuation.definition.link.end.markdown + +## https://custom-tests/link-reference-definitions + +[//]: # (This is a comment without a line-break.) +| ^ meta.link.reference.def.markdown markup.underline.link +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.other + +[//]: # (This is a comment with a +| ^ meta.link.reference.def.markdown markup.underline.link +| ^ punctuation.definition.string.begin + line-break.) +| ^ punctuation.definition.string.end + +[//]: # (testing)blah +|^^^^^^^^^^^^^^^^^^^^ meta.link.reference.def.markdown +| ^ punctuation.definition.string.begin +| ^ punctuation.definition.string.end +| ^^^^ invalid.illegal.expected-eol +| ^ - invalid + +[//]: # (testing +blah +| <- meta.link.reference.def.markdown string.quoted.other + +| <- invalid.illegal.non-terminated.link-title +text +| <- meta.paragraph - meta.link.reference.def.markdown + +## https://custom-tests/footnote-reference-definitions + + [^1]: And that's the footnote. +|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.reference.def.footnote.markdown-extra +|^ punctuation.definition.reference.begin.markdown +| ^^ entity.name.reference.link.markdown +| ^ punctuation.definition.reference.end.markdown +| ^ punctuation.separator.key-value.markdown + + [^1]: And that's the footnote. +|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.reference.def.footnote.markdown-extra +| ^ punctuation.definition.reference.begin.markdown +| ^^ entity.name.reference.link.markdown +| ^ punctuation.definition.reference.end.markdown +| ^ punctuation.separator.key-value.markdown + + [^1]: And that's the footnote. +|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.reference.def.footnote.markdown-extra +| ^ punctuation.definition.reference.begin.markdown +| ^^ entity.name.reference.link.markdown +| ^ punctuation.definition.reference.end.markdown +| ^ punctuation.separator.key-value.markdown + + [^1]: And that's no footnote. +|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.raw.block.markdown + +[^1]: + And that's the footnote +with a *second* line. +|^^^^^^^^^^^^^^^^^^^^ meta.link.reference.def.footnote.markdown-extra - markup.raw + +[^1]: + And that's the footnote. + + That's the *second* footnote paragraph. +|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.reference.def.footnote.markdown-extra - markup.raw +| ^^^^^^^^ markup.italic + +[^1]: + And that's the footnote. + + Not a footnote paragraph. +|^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.paragraph.markdown - meta.link + +[^1]: + And that's the footnote +with a *second* line. +[^2]: second +| <- meta.link.reference.def.footnote.markdown-extra punctuation.definition.reference.begin.markdown +|^^^^^^^^^^^^ meta.link.reference.def.footnote.markdown-extra +|^^ entity.name.reference.link.markdown +| ^ punctuation.definition.reference.end.markdown +| ^ punctuation.separator.key-value.markdown + +## https://custom-tests/footnote-reference-definitions/in-block-quotes + +> [^1]: And that's the footnote. +|^ markup.quote.markdown - meta.link +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown meta.link.reference.def.footnote.markdown-extra +| ^ punctuation.definition.reference.begin.markdown +| ^^ entity.name.reference.link.markdown +| ^ punctuation.definition.reference.end.markdown +| ^ punctuation.separator.key-value.markdown + +> [^1]: And that's the footnote. +|^ markup.quote.markdown - meta.link +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown meta.link.reference.def.footnote.markdown-extra +| ^ punctuation.definition.reference.begin.markdown +| ^^ entity.name.reference.link.markdown +| ^ punctuation.definition.reference.end.markdown +| ^ punctuation.separator.key-value.markdown + +> [^1]: And that's the footnote. +|^ markup.quote.markdown - meta.link +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown meta.link.reference.def.footnote.markdown-extra +| ^ punctuation.definition.reference.begin.markdown +| ^^ entity.name.reference.link.markdown +| ^ punctuation.definition.reference.end.markdown +| ^ punctuation.separator.key-value.markdown + +> [^1]: And that's no footnote. +|^ markup.quote.markdown - meta.link - markup.raw +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.raw.block.markdown + +> [^1]: And that's the footnote. +> with a *second* line. +| <- markup.quote.markdown meta.link.reference.def.footnote.markdown-extra punctuation.definition.blockquote.markdown +|^^^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown meta.link.reference.def.footnote.markdown-extra + +> [^1]: +> And that's the footnote. +> +> That's the *second* paragraph. +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown meta.link.reference.def.footnote.markdown-extra +| ^^^^^^^^ markup.italic + +> [^1]: +> And that's the footnote. +> +> Not a footnote paragraph. +| <- markup.quote.markdown punctuation.definition.blockquote.markdown - markup.link +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.paragraph.markdown - markup.link + +> [^1]: And that's the footnote. +> +> code block +| <- markup.quote.markdown punctuation.definition.blockquote.markdown - markup.raw +|^ markup.quote.markdown - markup.raw +| ^^^^^^^^^^^^^^^ markup.quote.markdown markup.raw.block.markdown + +> [^1]: +> And that's the footnote. +> + That's not a *second* paragraph. +|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.raw.block.markdown + +# TEST: TABLES ################################################################ + +| foo | bar | +|^^^^^^^^^^^^^ meta.table.header +| <- punctuation.separator.table-cell +| ^ punctuation.separator.table-cell +| ^ punctuation.separator.table-cell +| ^^^^ - punctuation.separator.table-cell + +| foo | bar | +| --- | --- | +| baz | bim Ctrl+C | +| <- meta.table punctuation.separator.table-cell +| ^^^^^ meta.tag.inline.any +| ^ punctuation.separator.table-cell + +| <- - meta.table + +| abc | defghi | +:-: | -----------: +|^^^^^^^^^^^^^^^^^ meta.table.header-separator +| <- punctuation.definition.table-cell-alignment +|^ punctuation.section.table-header +| ^ punctuation.separator.table-cell +| ^^^^^^^^^^^ punctuation.section.table-header +| ^ punctuation.definition.table-cell-alignment - punctuation.section.table-header +bar | baz +| ^ meta.table punctuation.separator.table-cell + +| f\|oo | +| <- meta.table punctuation.separator.table-cell +| ^^ meta.table constant.character.escape - punctuation.separator.table-cell +| ^ meta.table punctuation.separator.table-cell + +| f\|oo | +| ------ | +| b `|` az | +| ^^^ meta.table markup.raw.inline - meta.table.header-separator +| ^ meta.table punctuation.separator.table-cell +| b **|** im | +| <- meta.table punctuation.separator.table-cell +| ^^^^^ meta.table markup.bold - punctuation.separator.table-cell +| ^ meta.table punctuation.separator.table-cell + +| abc | def | +| --- | --- | +| bar | baz | +|^^^^^^^^^^^^^ meta.table +test +|^^^^ meta.table +> bar +| <- markup.quote punctuation.definition.blockquote - meta.table + +`|` this `|` example `|` is not a table `|` +| ^ punctuation.definition.raw.end - meta.table +| nor is this | because it is not at block level, it immediately follows a paragraph | +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.paragraph - meta.table + +| First Header | Second Header | Third Header | +| :------------ | :-----------: | -------------------: | +| First row | Data | Very long data entry | +| Second row | **Cell** | *Cell* | +| Third row | Cell that spans across two columns || +| ^^^^^^^^^^^^^^ meta.table +| ^^ punctuation.separator.table-cell + + | table that doesn't start at column 0 | + | ---- | + | blah | +| ^^^^^^^^ meta.table +| ^ punctuation.separator.table-cell + +not a table | +| ^^^^^^^^^^^^^ - meta.table + + abc | def + --- | --- + --- | --- +| ^^^^ meta.table - meta.table.header + + a | b + - | - +|^^^^^^ meta.table.header-separator.markdown-gfm +|^ punctuation.section.table-header.markdown +| ^ punctuation.separator.table-cell.markdown +| ^ punctuation.section.table-header.markdown + - | - +|^^^^^^ meta.table.markdown-gfm + + a | b + -:| - +|^^^^^^ meta.table.header-separator.markdown-gfm +|^ punctuation.section.table-header.markdown +| ^ punctuation.definition.table-cell-alignment.markdown +| ^ punctuation.separator.table-cell.markdown +| ^ punctuation.section.table-header.markdown + - | - +|^^^^^^ meta.table.markdown-gfm + +| test | me | +|------|----| +|^^^^^^ punctuation.section.table-header +|*test | me | +|^^^^^^ - markup.bold +| ^ punctuation.separator.table-cell +| ^ punctuation.separator.table-cell +|`test | me | +|^ invalid.deprecated.unescaped-backticks +| ^ punctuation.separator.table-cell + +| table | followed by +paragraph +| <- meta.paragraph.markdown +|^^^^^^^^^ meta.paragraph.markdown + +| table | followed by +https://foo.bar/baz +| <- meta.paragraph.markdown meta.link.inet.markdown markup.underline.link.markdown-gfm +|^^^^^^^^^^^^^^^^^^ meta.paragraph.markdown meta.link.inet.markdown markup.underline.link.markdown-gfm + +| table | followed by +# heading +| <- markup.heading.1.markdown punctuation.definition.heading.begin.markdown +|^^^^^^^^^ markup.heading.1.markdown + +| table | followed by +> quote +| <- markup.quote.markdown punctuation.definition.blockquote.markdown +|^^^^^^^ markup.quote.markdown + +| table | followed by + quote +| <- markup.raw.block.markdown +|^^^^^^^^^ markup.raw.block.markdown + +| table | followed by +```fenced +| <- meta.code-fence.definition.begin.text.markdown-gfm +|^^^^^^^^^ meta.code-fence.definition.begin.text.markdown-gfm +code block +``` +| <- meta.code-fence.definition.end.text.markdown-gfm +|^^ meta.code-fence.definition.end.text.markdown-gfm + +A line without bolded | +| ^ - punctuation.separator.table-cell + +A line with bolded **|** +| ^ - punctuation.separator.table-cell + + +# TEST: BLOCK QUOTES ########################################################## + +## https://spec.commonmark.org/0.30/#example-228 + +> # Foo +| <- markup.quote.markdown punctuation.definition.blockquote.markdown +|^ markup.quote.markdown - markup.heading +| ^^^^^^ markup.quote.markdown markup.heading.1.markdown +| ^ punctuation.definition.heading.begin.markdown +| ^^^ entity.name.section.markdown + +> # Foo +bar +| <- meta.paragraph.markdown - markup.quote +|^^ meta.paragraph.markdown - markup.quote + +> # Foo +> bar +| <- markup.quote.markdown punctuation.definition.blockquote.markdown +|^^^^^ markup.quote.markdown + +> # Foo +> bar +> baz +| <- markup.quote.markdown punctuation.definition.blockquote.markdown +|^^^^^ markup.quote.markdown + +## https://spec.commonmark.org/0.30/#example-229 + +># Foo +| <- markup.quote.markdown punctuation.definition.blockquote.markdown +|^^^^^^ markup.quote.markdown markup.heading.1.markdown +|^ punctuation.definition.heading.begin.markdown +| ^^^ entity.name.section.markdown + +># Foo +>bar +| <- markup.quote.markdown punctuation.definition.blockquote.markdown +|^^^^ markup.quote.markdown + +># Foo +>bar +> baz +| <- markup.quote.markdown punctuation.definition.blockquote.markdown +|^^^^^ markup.quote.markdown + +## https://spec.commonmark.org/0.30/#example-230 + + > # Foo +| <- markup.quote.markdown +|^^^^^^^^^^ markup.quote.markdown +| ^ punctuation.definition.blockquote.markdown +| ^^^^^^ markup.heading.1.markdown +| ^ punctuation.definition.heading.begin.markdown +| ^^^ entity.name.section.markdown + + > # Foo + > bar +| <- markup.quote.markdown - punctuation +|^^ markup.quote.markdown - punctuation +| ^ markup.quote.markdown punctuation.definition.blockquote.markdown +| ^^^^^ markup.quote.markdown - punctuation + + > # Foo + > bar + > baz +| <- markup.quote.markdown - punctuation +|^ markup.quote.markdown punctuation.definition.blockquote.markdown +| ^^^^^ markup.quote.markdown - punctuation + +## https://spec.commonmark.org/0.30/#example-231 + + > # Foo + > bar + > baz +| <- markup.raw.block.markdown +|^^^^^^^^^ markup.raw.block.markdown + +## https://spec.commonmark.org/0.30/#example-232 + +> # Foo +> bar +baz +| <- markup.quote.markdown +|^^^ markup.quote.markdown + +## https://spec.commonmark.org/0.30/#example-233 + +> bar +baz +| <- markup.quote.markdown +|^^^ markup.quote.markdown +> foo +| <- markup.quote.markdown punctuation.definition.blockquote.markdown +|^^^^^ markup.quote.markdown - punctuation + +## https://spec.commonmark.org/0.30/#example-234 + +> foo +*** +| <- meta.separator.thematic-break.markdown punctuation.definition.thematic-break.markdown - markup.quote +|^^ meta.separator.thematic-break.markdown punctuation.definition.thematic-break.markdown - markup.quote + +> foo +--- +| <- meta.separator.thematic-break.markdown punctuation.definition.thematic-break.markdown - markup.quote +|^^ meta.separator.thematic-break.markdown punctuation.definition.thematic-break.markdown - markup.quote + +> foo +___ +| <- meta.separator.thematic-break.markdown punctuation.definition.thematic-break.markdown - markup.quote +|^^ meta.separator.thematic-break.markdown punctuation.definition.thematic-break.markdown - markup.quote + +## https://spec.commonmark.org/0.30/#example-235 + +> - foo +- bar +| <- markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown - markup.quote +|^^^^^ markup.list.unnumbered.markdown - markup.quote + +## https://spec.commonmark.org/0.30/#example-236 + +> foo + bar +| <- markup.raw.block.markdown +|^^^^^^^ markup.raw.block.markdown + +## https://spec.commonmark.org/0.30/#example-237 + +> ``` +foo +| <- meta.paragraph.markdown - markup.quote - markup.raw +|^^^ meta.paragraph.markdown - markup.quote - markup.raw + +## https://spec.commonmark.org/0.30/#example-238 + +> foo + - bar +| <- markup.quote.markdown - markup.list - markup.raw +|^^^^^^^^^ markup.quote.markdown - markup.list - markup.raw + +## https://spec.commonmark.org/0.30/#example-239 + +> +| <- markup.quote.markdown punctuation.definition.blockquote.markdown +|^ markup.quote.markdown + +## https://spec.commonmark.org/0.30/#example-240 + +> +> +> +| <- markup.quote.markdown punctuation.definition.blockquote.markdown +|^^ markup.quote.markdown + +## https://spec.commonmark.org/0.30/#example-241 + +> +> foo +> +| <- markup.quote.markdown punctuation.definition.blockquote.markdown +|^^^ markup.quote.markdown + +## https://spec.commonmark.org/0.30/#example-242 + +> foo + +| <- - markup.quote +> foo + +> bar +| <- markup.quote.markdown punctuation.definition.blockquote.markdown +|^^^^^ markup.quote.markdown + +## https://spec.commonmark.org/0.30/#example-243 + +> foo +> bar +| <- markup.quote.markdown punctuation.definition.blockquote.markdown +|^^^^^ markup.quote.markdown + +## https://spec.commonmark.org/0.30/#example-244 + +> foo +> +| <- markup.quote.markdown punctuation.definition.blockquote.markdown +> bar +| <- markup.quote.markdown punctuation.definition.blockquote.markdown + +## https://spec.commonmark.org/0.30/#example-245 + +foo +> bar +| <- markup.quote.markdown punctuation.definition.blockquote.markdown +|^^^^^ markup.quote.markdown + +## https://spec.commonmark.org/0.30/#example-246 + +> aaa +*** +> bbb +| <- markup.quote.markdown punctuation.definition.blockquote.markdown +|^^^^^ markup.quote.markdown + +## https://spec.commonmark.org/0.30/#example-247 + +> bar +baz +| <- markup.quote.markdown +|^^^ markup.quote.markdown + +## https://spec.commonmark.org/0.30/#example-248 + +> bar + +baz +| <- meta.paragraph.markdown - markup.quote +|^^ meta.paragraph.markdown - markup.quote + +## https://spec.commonmark.org/0.30/#example-249 + +> bar +> +baz +| <- meta.paragraph.markdown - markup.quote +|^^ meta.paragraph.markdown - markup.quote + +## https://spec.commonmark.org/0.30/#example-250 + +> > > foo +| <- markup.quote.markdown punctuation.definition.blockquote.markdown +|^^^^^^^^^ markup.quote.markdown +| ^ punctuation.definition.blockquote.markdown +| ^ punctuation.definition.blockquote.markdown +| ^^^^^ - punctuation + +> > > foo +bar +| <- markup.quote.markdown +|^^^ markup.quote.markdown + +## https://spec.commonmark.org/0.30/#example-251 + +>>> foo +> bar +>>baz +| <- markup.quote.markdown punctuation.definition.blockquote.markdown +|^ markup.quote.markdown punctuation.definition.blockquote.markdown +| ^^^^ markup.quote.markdown - punctuation + +## https://spec.commonmark.org/0.30/#example-252 + +> code +| <- markup.quote.markdown punctuation.definition.blockquote.markdown +|^ markup.quote.markdown - markup.raw +| ^^^^^^^^^ markup.quote.markdown markup.raw.block.markdown + +> not code +| <- markup.quote.markdown punctuation.definition.blockquote.markdown - markup.raw +|^^^^^^^^^^^^^ markup.quote.markdown - markup.raw + +## https://custom-tests/block-quotes/block-quote-starts + +>= +| <- punctuation.definition.blockquote.markdown + +>== +| <- punctuation.definition.blockquote.markdown + + >= +| ^ punctuation.definition.blockquote.markdown + >= +| ^^^^^ markup.quote.markdown - punctuation + + >= +| ^^ markup.raw.block.markdown - markup.quote - punctuation + +## https://custom-tests/block-quotes/block-quote-nesting + +> > Nested block quote +| <- markup.quote punctuation.definition.blockquote +| ^^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown +|^ - punctuation +| ^ punctuation.definition.blockquote +| ^ - punctuation + +> > Nested quote +> Followed by more quoted text that is not nested +| <- markup.quote punctuation.definition.blockquote - markup.quote markup.quote + +> > this is a nested quote but no code in a block quote +| <- punctuation.definition.blockquote +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown + +> > this is a nested quote but no code in a block quote +> > with a second line of content +| <- punctuation.definition.blockquote +|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.paragraph.markdown +| ^ - punctuation + +> > this is code in a block quote, not a nested quote +| <- punctuation.definition.blockquote +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.raw.block - markup.quote markup.quote + +## https://custom-tests/block-quotes/block-quote-terminations + +> Block quote followed by heading +# heading +| <- markup.heading.1.markdown punctuation.definition.heading.begin.markdown +|^^^^^^^^^ markup.heading.1.markdown - meta.quote +| ^^^^^^^ entity.name.section.markdown + +> Block quote followed by unordered list +* list item +| <- markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown +|^^^^^^^^^^^ markup.list.unnumbered.markdown - meta.quote + +> Block quote followed by unordered list ++ list item +| <- markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown +|^^^^^^^^^^^ markup.list.unnumbered.markdown - meta.quote + +> Block quote followed by unordered list +- list item +| <- markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown +|^^^^^^^^^^^ markup.list.unnumbered.markdown - meta.quote + +> Block quote followed by ordered list +1. list item +| <- markup.list.numbered.bullet.markdown - punctuation +|^ markup.list.numbered.bullet.markdown punctuation.definition.list_item.markdown +| ^^^^^^^^^^ markup.list.numbered.markdown - meta.quote + +> Block quote followed by ordered list +2. list item +| <- markup.list.numbered.bullet.markdown - punctuation +|^ markup.list.numbered.bullet.markdown punctuation.definition.list_item.markdown +| ^^^^^^^^^^ markup.list.numbered.markdown - meta.quote + +> Block quote followed by invalid list +1234567890. no list item +| <- markup.quote.markdown - markup.list +|^^^^^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown - markup.list + +> Block quote followed by html block +

*no-markdown

+| <- meta.disable-markdown meta.tag.block +|^^^^^^^^^^^^^^^^^^^ meta.disable-markdown + +## https://custom-tests/block-quotes/thematic-breaks + +> * * * +paragraph +| <- meta.paragraph.markdown - markup.quote + +> - - - +paragraph +| <- meta.paragraph.markdown - markup.quote + +> _ _ _ +paragraph +| <- meta.paragraph.markdown - markup.quote + +> paragraph +> * * * +| ^^^^^^ markup.quote.markdown meta.separator.thematic-break.markdown + +> paragraph +> - - - +| ^^^^^^ markup.quote.markdown meta.separator.thematic-break.markdown + +> paragraph +> _ _ _ +| ^^^^^^ markup.quote.markdown meta.separator.thematic-break.markdown + +## https://custom-tests/block-quotes/fenced-code-blocks + +> Quoted fenced code block begin +> ``` +| <- markup.quote.markdown punctuation.definition.blockquote.markdown +|^ markup.quote.markdown - meta.code-fence +| ^^^^ markup.quote.markdown meta.code-fence.definition.begin.text.markdown-gfm +| ^^^ punctuation.definition.raw.code-fence.begin.markdown + +> Quoted fenced code block language identifier +> ```C++ +| <- markup.quote.markdown punctuation.definition.blockquote.markdown +|^ markup.quote.markdown - meta.code-fence +| ^^^^^^^ markup.quote.markdown meta.code-fence.definition.begin.text.markdown-gfm +| ^^^ constant.other.language-name.markdown + +> Quoted fenced code block language identifier +> ```C++ info string +| <- markup.quote.markdown punctuation.definition.blockquote.markdown +|^ markup.quote.markdown - meta.code-fence +| ^^^^^^^^^^^^^^^^^^^ markup.quote.markdown meta.code-fence.definition.begin.text.markdown-gfm +| ^^^ constant.other.language-name.markdown +| ^^^^^^^^^^^^^ - constant + +> Quoted fenced code block content +> ``` +> code block +| <- markup.quote.markdown punctuation.definition.blockquote.markdown +|^ markup.quote.markdown - meta.code-fence +| ^^^^^^^^^^^ markup.quote.markdown markup.raw.code-fence.markdown-gfm + +> Quoted fenced code block end +> ``` +> ``` +| <- markup.quote.markdown punctuation.definition.blockquote.markdown +|^ markup.quote.markdown - meta.code-fence +| ^^^^ markup.quote.markdown meta.code-fence.definition.end.text.markdown-gfm +| ^^^ punctuation.definition.raw.code-fence.end.markdown + +> > 2nd level quoted fenced code block +> > ``` +> > code block ``` +| ^^^ - punctuation + +> > 2nd level quoted fenced code block +> > ``` +> > code block ``` +> > ``` +| <- markup.quote.markdown punctuation.definition.blockquote.markdown +|^^^ markup.quote.markdown - meta.code-fence +| ^^^ markup.quote.markdown meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown + +> Block quote followed by fenced code block +``` +| <- meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown - meta.quote +``` +| <- meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown - meta.quote + +> Quoted fenced code block is terminated by missing > at bol +> ``` +no code block +| <- meta.paragraph.markdown - meta.quote - meta.code-fence +|^^^^^^^^^^^^^ meta.paragraph.markdown - meta.quote - meta.code-fence + +> Quoted fenced code block is terminated by missing > at bol +> ``` +> content +no code block +| <- meta.paragraph.markdown - meta.quote - meta.code-fence +|^^^^^^^^^^^^^ meta.paragraph.markdown - meta.quote - meta.code-fence + +> Unterminated quoted fenced code block followed by unquoted fenced code block +> ``` +``` +| <- meta.code-fence.definition.begin.text.markdown-gfm - markup.quote +``` +| <- meta.code-fence.definition.end.text.markdown-gfm - markup.quote + +> > ``` +> This is a paragraph highlight as code, +> because nested block quotes can't be counted. +| <- markup.quote.markdown punctuation.definition.blockquote.markdown +|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown + +## https://custom-tests/block-quotes/list-blocks/basics + +> Block quote with lists +> - list item 1 +| ^ markup.quote punctuation.definition.list_item +> - list item 2 +| ^ markup.list.unnumbered.bullet punctuation.definition.list_item +| ^^^^^^^^^^^^^^ markup.quote markup.list.unnumbered +> 1. sub list item +| <- markup.quote punctuation.definition.blockquote +|^^^^^^^^^^^^^^^^^^ markup.quote +| ^^^^^^^^^^^^^^^^^^^ markup.list.unnumbered +| ^ punctuation.definition.list_item +| ^^ markup.list.numbered.bullet +> - list item 3 + continued +| ^^^^^^^^^^ markup.quote.markdown markup.list.unnumbered.markdown + +## https://custom-tests/block-quotes/list-blocks/items-with-line-continuation + +> * list item +> second line +| <- markup.quote.markdown markup.list.unnumbered.markdown punctuation.definition.blockquote.markdown +> + subitem +> second line +| <- markup.quote.markdown markup.list.unnumbered.markdown punctuation.definition.blockquote.markdown +> - subitem +> second line +| <- markup.quote.markdown markup.list.unnumbered.markdown punctuation.definition.blockquote.markdown +> - subitem +> second line +| <- markup.quote.markdown markup.list.unnumbered.markdown punctuation.definition.blockquote.markdown + +> * list item +second line +| <- markup.quote.markdown markup.list.unnumbered.markdown +> + subitem + second line +| <- markup.quote.markdown markup.list.unnumbered.markdown +> - subitem + second line +| <- markup.quote.markdown markup.list.unnumbered.markdown +> - subitem + second line +| <- markup.quote.markdown markup.list.unnumbered.markdown + +> 1. list item +> second line +| <- markup.quote.markdown markup.list.numbered.markdown punctuation.definition.blockquote.markdown +> 2. subitem +> second line +| <- markup.quote.markdown markup.list.numbered.markdown punctuation.definition.blockquote.markdown +> 3. subitem +> second line +| <- markup.quote.markdown markup.list.numbered.markdown punctuation.definition.blockquote.markdown +> 4. subitem +> second line +| <- markup.quote.markdown markup.list.numbered.markdown punctuation.definition.blockquote.markdown + +> 1. list item +second line +| <- markup.quote.markdown markup.list.numbered.markdown +> 2. subitem + second line +| <- markup.quote.markdown markup.list.numbered.markdown +> 3. subitem + second line +| <- markup.quote.markdown markup.list.numbered.markdown +> 4. subitem + second line +| <- markup.quote.markdown markup.list.numbered.markdown + +> 1. list item +> second line +| <- markup.quote.markdown markup.list.numbered.markdown punctuation.definition.blockquote.markdown +> + subitem +> second line +| <- markup.quote.markdown markup.list.numbered.markdown punctuation.definition.blockquote.markdown +> - subitem +> second line +| <- markup.quote.markdown markup.list.numbered.markdown punctuation.definition.blockquote.markdown +> - subitem +> second line +| <- markup.quote.markdown markup.list.numbered.markdown punctuation.definition.blockquote.markdown + +> 1. list item +second line +| <- markup.quote.markdown markup.list.numbered.markdown +> + subitem + second line +| <- markup.quote.markdown markup.list.numbered.markdown +> - subitem + second line +| <- markup.quote.markdown markup.list.numbered.markdown +> - subitem + second line +| <- markup.quote.markdown markup.list.numbered.markdown + +## https://custom-tests/block-quotes/list-blocks/items-with-thematic-breaks + +> - * * * * * * * +| ^^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.unnumbered +| ^ punctuation.definition.list_item.markdown +| ^^^^^^^^^^^^^^ meta.separator.thematic-break.markdown +| ^ punctuation.definition.thematic-break +| ^ - punctuation +| ^ punctuation.definition.thematic-break +| ^ - punctuation +| ^ punctuation.definition.thematic-break +| ^ - punctuation +| ^ punctuation.definition.thematic-break +| ^ - punctuation +| ^ punctuation.definition.thematic-break +| ^ - punctuation +| ^ punctuation.definition.thematic-break +| ^ - punctuation +| ^ punctuation.definition.thematic-break +| ^ - punctuation + +> - * * * * * * * +> still a list item +| ^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.unnumbered.markdown + +> - - * * * * * * +| ^^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.unnumbered +| ^ punctuation.definition.list_item.markdown +| ^ punctuation.definition.list_item.markdown +| ^ - punctuation +| ^^^^^^^^^^^^ markup.list.unnumbered.markdown meta.separator.thematic-break.markdown +| ^ punctuation.definition.thematic-break +| ^ - punctuation +| ^ punctuation.definition.thematic-break +| ^ - punctuation +| ^ punctuation.definition.thematic-break +| ^ - punctuation +| ^ punctuation.definition.thematic-break +| ^ - punctuation +| ^ punctuation.definition.thematic-break +| ^ - punctuation +| ^ punctuation.definition.thematic-break +| ^ - punctuation + +> - - * * * * * * +> still a list item +| <- markup.quote.markdown markup.list.unnumbered.markdown punctuation.definition.blockquote.markdown +|^ markup.quote.markdown markup.list.unnumbered.markdown - meta.paragraph +| ^^^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.unnumbered.markdown meta.paragraph.list.markdown + +> 1. * * * * * * * +| ^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.numbered +| ^^ markup.list.numbered.bullet.markdown +| ^^^^^^^^^^^^^^ markup.list.numbered.markdown meta.separator.thematic-break.markdown +| ^ punctuation.definition.thematic-break +| ^ - punctuation +| ^ punctuation.definition.thematic-break +| ^ - punctuation +| ^ punctuation.definition.thematic-break +| ^ - punctuation +| ^ punctuation.definition.thematic-break +| ^ - punctuation +| ^ punctuation.definition.thematic-break +| ^ - punctuation +| ^ punctuation.definition.thematic-break +| ^ - punctuation +| ^ punctuation.definition.thematic-break +| ^ - punctuation + +> 1. * * * * * * * +> still a list item +| <- markup.quote.markdown markup.list.numbered.markdown punctuation.definition.blockquote.markdown +|^ markup.quote.markdown markup.list.numbered.markdown - meta.paragraph +| ^^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.numbered.markdown meta.paragraph.list.markdown + +## https://custom-tests/block-quotes/list-blocks/unordered-items-with-atx-headings + +> * list item +> # global heading + | <- markup.quote.markdown markup.heading.1.markdown punctuation.definition.heading.begin.markdown - markup.list + |^^^^^^^^^^^^^^^^ markup.quote.markdown markup.heading.1.markdown - markup.list +> +> * list item +> # global heading (matched as list item heading) + | <- markup.quote.markdown markup.list.unnumbered.markdown markup.heading.1.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.unnumbered.markdown markup.heading.1.markdown +> +> * list item +> # list item heading + | <- markup.quote.markdown markup.list.unnumbered.markdown markup.heading.1.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.unnumbered.markdown markup.heading.1.markdown +> * list item +> ## list item heading + | <- markup.quote.markdown markup.list.unnumbered.markdown markup.heading.2.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.unnumbered.markdown markup.heading.2.markdown +> + list item +> ### list item heading + | <- markup.quote.markdown markup.list.unnumbered.markdown markup.heading.3.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.unnumbered.markdown markup.heading.3.markdown +> + list item +> ### list item heading +> + list item +> #### list item heading + | <- markup.quote.markdown markup.list.unnumbered.markdown markup.heading.4.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.unnumbered.markdown markup.heading.4.markdown + +> * +> # list item heading + | <- markup.quote.markdown markup.list.unnumbered.markdown markup.heading.1.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.unnumbered.markdown markup.heading.1.markdown +> + +> # list item heading + | <- markup.quote.markdown markup.list.unnumbered.markdown markup.heading.1.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.unnumbered.markdown markup.heading.1.markdown +> + +> # list item heading +> - +> # list item heading 1 + | <- markup.quote.markdown markup.list.unnumbered.markdown markup.heading.1.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.unnumbered.markdown markup.heading.1.markdown +> + +> # list item heading +> - +> # list item heading 1 +> +> ## list item heading 2 + | <- markup.quote.markdown markup.list.unnumbered.markdown markup.heading.2.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.unnumbered.markdown markup.heading.2.markdown + +> ## not a list item heading + | <- markup.quote.markdown markup.raw.block.markdown + |^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.raw.block.markdown + +> * +> +> # list item heading + | <- markup.quote.markdown markup.list.unnumbered.markdown markup.heading.1.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.unnumbered.markdown markup.heading.1.markdown +> +> + +> +> # list item heading + | <- markup.quote.markdown markup.list.unnumbered.markdown markup.heading.1.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.unnumbered.markdown markup.heading.1.markdown +> + +> +> # list item heading +> +> - +> +> # list item heading 1 + | <- markup.quote.markdown markup.list.unnumbered.markdown markup.heading.1.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.unnumbered.markdown markup.heading.1.markdown +> + +> +> # list item heading +> +> - +> +> # list item heading 1 +> +> ## list item heading 2 + | <- markup.quote.markdown markup.list.unnumbered.markdown markup.heading.2.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.unnumbered.markdown markup.heading.2.markdown + +> ## not a list item heading + | <- markup.quote.markdown markup.raw.block.markdown + |^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.raw.block.markdown + +## https://custom-tests/block-quotes/list-blocks/ordered-items-with-atx-headings + +> +> 1. list item +> # global heading + | <- markup.quote.markdown markup.heading.1.markdown punctuation.definition.heading.begin.markdown - markup.list + |^^^^^^^^^^^^^^^^ markup.quote.markdown markup.heading.1.markdown - markup.list +> +> 2. list item +> # global heading (matched as list item heading) + | <- markup.quote.markdown markup.list.numbered.markdown markup.heading.1.markdown punctuation.definition.heading.begin.markdown +> |^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.numbered.markdown markup.heading.1.markdown +> +> 3. list item +> # list item heading + | <- markup.quote.markdown markup.list.numbered.markdown markup.heading.1.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.numbered.markdown markup.heading.1.markdown +> 1. list item +> # list item heading + | <- markup.quote.markdown markup.list.numbered.markdown markup.heading.1.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.numbered.markdown markup.heading.1.markdown +> 2. list item +> # list item heading +> 1. list item +> # list item heading + | <- markup.quote.markdown markup.list.numbered.markdown markup.heading.1.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.numbered.markdown markup.heading.1.markdown +> 3. list item +> # list item heading + | <- markup.quote.markdown markup.list.numbered.markdown markup.heading.1.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.numbered.markdown markup.heading.1.markdown + +> 1. +> # list item heading + | <- markup.quote.markdown markup.list.numbered.markdown markup.heading.1.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.numbered.markdown markup.heading.1.markdown +> 1. +> # list item heading + | <- markup.quote.markdown markup.list.numbered.markdown markup.heading.1.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.numbered.markdown markup.heading.1.markdown +> 1. +> # list item heading +> 1. +> # list item heading + | <- markup.quote.markdown markup.list.numbered.markdown markup.heading.1.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.numbered.markdown markup.heading.1.markdown +> 1. +> # list item heading +> 1. +> # list item heading +> +> ## list item heading 2 + | <- markup.quote.markdown markup.list.numbered.markdown markup.heading.2.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.numbered.markdown markup.heading.2.markdown + +> 1. +> +> # list item heading + | <- markup.quote.markdown markup.list.numbered.markdown markup.heading.1.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.numbered.markdown markup.heading.1.markdown +> +> 1. +> +> # list item heading + | <- markup.quote.markdown markup.list.numbered.markdown markup.heading.1.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.numbered.markdown markup.heading.1.markdown +> 1. +> +> # list item heading +> +> 1. +> +> # list item heading 1 + | <- markup.quote.markdown markup.list.numbered.markdown markup.heading.1.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.numbered.markdown markup.heading.1.markdown +> 1. +> +> # list item heading +> +> 1. +> +> # list item heading 1 +> +> ## list item heading 2 + | <- markup.quote.markdown markup.list.numbered.markdown markup.heading.2.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.numbered.markdown markup.heading.2.markdown + +## https://custom-tests/block-quotes/list-blocks/items-with-fenced-code-blocks + +> 1. item +> + item +> - item +> ```C++ +| <- markup.quote.markdown markup.list.numbered.markdown punctuation.definition.blockquote.markdown +|^ markup.quote.markdown markup.list.numbered.markdown - meta.code-fence +| ^^^^^^^^^^^^^^ markup.quote.markdown markup.list.numbered.markdown meta.code-fence.definition.begin.text.markdown-gfm +| ^^^ punctuation.definition.raw.code-fence.begin.markdown +| ^^^ constant.other.language-name.markdown + +> 1. item +> + item +> - item +> ```C++ +> code +| <- markup.quote.markdown punctuation.definition.blockquote.markdown +|^ markup.quote.markdown markup.list.numbered.markdown - meta.code-fence +| ^^^^^^^^^^^^ markup.quote.markdown markup.list.numbered.markdown markup.raw.code-fence.markdown-gfm + +> 1. item +> + item +> - item +> ```C++ +> code +> ``` +| <- markup.quote.markdown punctuation.definition.blockquote.markdown +|^ markup.quote.markdown markup.list.numbered.markdown - meta.code-fence +| ^^^^^^^^^^^ markup.quote.markdown markup.list.numbered.markdown meta.code-fence.definition.end.text.markdown-gfm +| ^^^ punctuation.definition.raw.code-fence.end.markdown + +## https://custom-tests/block-quotes/list-blocks/unordered-items-with-reference-definitions + +> * list item [ref] + | ^^^^^ markup.list.unnumbered.markdown meta.link.reference.description.markdown +> +> + sub item [ref] + | ^^^^^ markup.list.unnumbered.markdown meta.link.reference.description.markdown +> +> [ref]: /url + | <- markup.list.unnumbered.markdown meta.link.reference.def.markdown punctuation.definition.reference.begin.markdown + |^^^^^^^^^^^ markup.list.unnumbered.markdown meta.link.reference.def.markdown + |^^^ entity.name.reference.link.markdown + | ^ punctuation.definition.reference.end.markdown + | ^ punctuation.separator.key-value.markdown + | ^^^^ markup.underline.link.markdown +> +> + sub item [ref] +> - sub item [ref] + | ^^^^^ markup.list.unnumbered.markdown meta.link.reference.description.markdown +> +> [ref]: /url + | <- markup.list.unnumbered.markdown meta.link.reference.def.markdown punctuation.definition.reference.begin.markdown + |^^^^^^^^^^^ markup.list.unnumbered.markdown meta.link.reference.def.markdown + |^^^ entity.name.reference.link.markdown + | ^ punctuation.definition.reference.end.markdown + | ^ punctuation.separator.key-value.markdown + | ^^^^ markup.underline.link.markdown +> +> + sub item [ref] +> - sub item [ref] +> +> [ref]: /url +> +> [ref]: /url + | <- markup.list.unnumbered.markdown meta.link.reference.def.markdown punctuation.definition.reference.begin.markdown + |^^^^^^^^^^^ markup.list.unnumbered.markdown meta.link.reference.def.markdown + |^^^ entity.name.reference.link.markdown + | ^ punctuation.definition.reference.end.markdown + | ^ punctuation.separator.key-value.markdown + | ^^^^ markup.underline.link.markdown + +## https://custom-tests/block-quotes/list-blocks/ordered-items-with-reference-definitions + +> 1. list item [ref] + | ^^^^^ markup.list.numbered.markdown meta.link.reference.description.markdown +> +> 2. sub item [ref] +> | ^^^^^ markup.list.numbered.markdown meta.link.reference.description.markdown +> +> [ref]: /url + | <- markup.list.numbered.markdown meta.link.reference.def.markdown punctuation.definition.reference.begin.markdown + |^^^^^^^^^^^ markup.list.numbered.markdown meta.link.reference.def.markdown + |^^^ entity.name.reference.link.markdown + | ^ punctuation.definition.reference.end.markdown + | ^ punctuation.separator.key-value.markdown + | ^^^^ markup.underline.link.markdown +> +> 2. sub item [ref] +> 3. sub item [ref] +> | ^^^^^ markup.list.numbered.markdown meta.link.reference.description.markdown +> +> [ref]: /url + | <- markup.list.numbered.markdown meta.link.reference.def.markdown punctuation.definition.reference.begin.markdown + |^^^^^^^^^^^ markup.list.numbered.markdown meta.link.reference.def.markdown + |^^^ entity.name.reference.link.markdown + | ^ punctuation.definition.reference.end.markdown + | ^ punctuation.separator.key-value.markdown + | ^^^^ markup.underline.link.markdown +> +> 2. sub item [ref] +> 3. sub item [ref] +> +> [ref]: /url +> +> [ref]: /url + | <- markup.list.numbered.markdown meta.link.reference.def.markdown punctuation.definition.reference.begin.markdown + |^^^^^^^^^^^ markup.list.numbered.markdown meta.link.reference.def.markdown + |^^^ entity.name.reference.link.markdown + | ^ punctuation.definition.reference.end.markdown + | ^ punctuation.separator.key-value.markdown + | ^^^^ markup.underline.link.markdown + +## https://custom-tests/block-quotes/list-blocks/items-with-reference-definitions + +> 1. item +> + item +> - item [foo] +> +> [foo]: /url "description" +| <- markup.quote.markdown markup.list.numbered.markdown punctuation.definition.blockquote.markdown +|^ markup.quote.markdown markup.list.numbered.markdown - meta.link +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.numbered.markdown meta.link.reference.def.markdown +| ^ punctuation.definition.reference.begin.markdown +| ^^^ entity.name.reference.link.markdown +| ^ punctuation.definition.reference.end.markdown +| ^ punctuation.separator.key-value.markdown +| ^^^^ markup.underline.link.markdown +| ^^^^^^^^^^^^^ meta.string.title.markdown string.quoted.double.markdown + +> 1. item +> + item +> - item [foo] +> +> [foo]: +> /url "description" +| <- markup.quote.markdown markup.list.numbered.markdown meta.link.reference.def.markdown punctuation.definition.blockquote.markdown +|^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.numbered.markdown meta.link.reference.def.markdown +| ^^^^ markup.underline.link.markdown +| ^^^^^^^^^^^^^ meta.string.title.markdown string.quoted.double.markdown + +> 1. item +> + item +> - item [foo] +> +> [foo]: +> /url +> "description" +| <- markup.quote.markdown markup.list.numbered.markdown meta.link.reference.def.markdown punctuation.definition.blockquote.markdown +|^^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.numbered.markdown meta.link.reference.def.markdown +| ^^^^^^^^^^^^^ meta.string.title.markdown string.quoted.double.markdown + +> 1. item +> + item +> - item [foo] +> +> [foo]: +> -continuation> +| <- markup.quote.markdown markup.list.numbered.markdown meta.link.reference.def.markdown markup.underline.link.markdown punctuation.definition.blockquote.markdown +|^^^^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.numbered.markdown meta.link.reference.def.markdown +|^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.markdown +| ^ punctuation.definition.link.end.markdown + +> 1. item +> + item +> - item [foo] +> +> [foo]: + /url "description" +|<- markup.quote.markdown markup.list.numbered.markdown meta.link.reference.def.markdown +|^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.numbered.markdown meta.link.reference.def.markdown +| ^^^^ markup.underline.link.markdown +| ^^^^^^^^^^^^^ meta.string.title.markdown string.quoted.double.markdown + +> 1. item +> + item +> - item [foo] +> +> [foo]: + /url + "description" +| <- markup.quote.markdown - meta.string - string - punctuation +|^^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.numbered.markdown meta.link.reference.def.markdown +| ^^^^^^^^^^^^^ meta.string.title.markdown string.quoted.double.markdown + +> 1. item +> + item +> - item [foo] +> +> [foo]: + +| <- markup.quote.markdown markup.list.numbered.markdown meta.link.reference.def.markdown markup.underline.link.markdown +|^^^^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.numbered.markdown meta.link.reference.def.markdown +|^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.markdown +| ^ punctuation.definition.link.end.markdown + +## https://custom-tests/block-quotes/list-blocks/items-with-footnote-definitions + +> 1. list item +> + sub item +> - sub item [^1] +> +> [^1]: +> This is a foot note +> with a second line +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.numbered.markdown meta.link.reference.def.footnote.markdown-extra + +> 1. list item +> + sub item +> - sub item [^1] +> +> [^1]: +> This is a foot note +> with a second line +> [^2]: +| ^^^^^^ markup.quote.markdown markup.list.numbered.markdown meta.link.reference.def.footnote.markdown-extra +| ^ punctuation.definition.reference.begin.markdown +| ^^ entity.name.reference.link.markdown +| ^ punctuation.definition.reference.end.markdown +| ^ punctuation.separator.key-value.markdown + +> 1. list item +> + sub item +> - sub item [^1] +> +> [^1]: +> This is a foot note +> with a second line +> # header +|^ markup.quote.markdown markup.list.numbered.markdown - markup.heading +| ^^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.numbered.markdown markup.heading.1.markdown + +> 1. list item +> + sub item +> - sub item [^1] +> +> [^1]: +> This is a foot note +> with a second line +> - sub item +|^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.numbered.markdown +| ^ markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown + +## https://custom-tests/block-quotes#gfm-tasks + +> Block quote with GFM tasks +> * [ ] task +| ^^^^^^^^^^^ markup.quote.markdown +| ^ markup.list.unnumbered.bullet.markdown +| ^^^^^^^^^^ markup.list.unnumbered.markdown +| ^ punctuation.definition.list_item.markdown +| ^ markup.checkbox.begin.markdown-gfm punctuation.definition.checkbox.begin.markdown-gfm +| ^ markup.checkbox.mark.markdown-gfm - punctuation +| ^ markup.checkbox.end.markdown-gfm punctuation.definition.checkbox.end.markdown-gfm +> * [x] task +| ^^^^^^^^^^^ markup.quote.markdown +| ^ markup.list.unnumbered.bullet.markdown +| ^^^^^^^^^^ markup.list.unnumbered.markdown +| ^ punctuation.definition.list_item.markdown +| ^ markup.checkbox.begin.markdown-gfm punctuation.definition.checkbox.begin.markdown-gfm +| ^ markup.checkbox.mark.markdown-gfm - punctuation +| ^ markup.checkbox.end.markdown-gfm punctuation.definition.checkbox.end.markdown-gfm +> * [X] task +| ^^^^^^^^^^^ markup.quote.markdown +| ^ markup.list.unnumbered.bullet.markdown +| ^^^^^^^^^^ markup.list.unnumbered.markdown +| ^ punctuation.definition.list_item.markdown +| ^ markup.checkbox.begin.markdown-gfm punctuation.definition.checkbox.begin.markdown-gfm +| ^ markup.checkbox.mark.markdown-gfm - punctuation +| ^ markup.checkbox.end.markdown-gfm punctuation.definition.checkbox.end.markdown-gfm +> * [X] task +> - [ ] task +| ^^^^^^^^^^^^^ markup.quote.markdown +| ^ markup.list.unnumbered.bullet.markdown +| ^^^^^^^^^^ markup.list.unnumbered.markdown +| ^ punctuation.definition.list_item.markdown +| ^ markup.checkbox.begin.markdown-gfm punctuation.definition.checkbox.begin.markdown-gfm +| ^ markup.checkbox.mark.markdown-gfm - punctuation +| ^ markup.checkbox.end.markdown-gfm punctuation.definition.checkbox.end.markdown-gfm + +## https://custom-tests/block-quotes#emphasis + +> Blcok quotes support markup, +> like *italics*, **bold**, ***bold italic*** and ~~strikethrough~~. +|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown +| ^^^^^^^^^ markup.italic.markdown +| ^^^^^^^^ markup.bold.markdown +| ^^ markup.bold.markdown punctuation.definition.bold.begin.markdown +| ^ markup.bold.markdown markup.italic.markdown punctuation.definition.italic.begin.markdown +| ^^^^^^^^^^^ markup.bold.markdown markup.italic.markdown - punctuation +| ^ markup.bold.markdown markup.italic.markdown punctuation.definition.italic.end.markdown +| ^^ markup.bold.markdown punctuation.definition.bold.end.markdown +| ^^^^^^^^^^^^^^^^^ markup.strikethrough.markdown-gfm + + +# TEST: LIST BLOCKS ########################################################### + +## https://spec.commonmark.org/0.30/#example-253 + +A paragraph +with two lines. + + indented code + +> A block quote. +| <- markup.quote.markdown punctuation.definition.blockquote.markdown - markup.raw +|^^^^^^^^^^^^^^^^ markup.quote.markdown - markup.raw + +## https://spec.commonmark.org/0.30/#example-254 + +1. A paragraph + with two lines. + + indented code + + > A block quote. +| <- markup.list.numbered.markdown markup.quote.markdown +|^^^^^^^^^^^^^^^^^^^^ markup.list.numbered.markdown markup.quote.markdown +| ^ punctuation.definition.blockquote.markdown + +## https://spec.commonmark.org/0.30/#example-255 + +- one + + two +| <- markup.list.unnumbered.markdown +|^^^^ markup.list.unnumbered.markdown + +> Note: `two` is not a part of the list item, but ST can't handle it! + +## https://spec.commonmark.org/0.30/#example-256 + +- one + + two +| <- markup.list.unnumbered.markdown +|^^^^^ markup.list.unnumbered.markdown + +## https://spec.commonmark.org/0.30/#example-257 + + - one + + two +| <- markup.list.unnumbered.markdown +|^^^^^^^^ markup.list.unnumbered.markdown + +> Note: `two` is not a part of the list item, but ST can't handle it! + +## https://spec.commonmark.org/0.30/#example-258 + + - one + + two +| <- markup.list.unnumbered.markdown +|^^^^^^^^^ markup.list.unnumbered.markdown + +## https://spec.commonmark.org/0.30/#example-261 + +Note that at least one space or tab is needed between the list marker +and any following content, so these are not list items: + +-one +| <- meta.paragraph.markdown - markup.list +|^^^^ meta.paragraph.markdown - markup.list + +2.two +| <- meta.paragraph.markdown - markup.list +|^^^^^ meta.paragraph.markdown - markup.list + +## https://spec.commonmark.org/0.30/#example-262 + +A list item may contain blocks that are separated by more than one blank line. + +- foo + + + bar + | <- markup.list.unnumbered.markdown + |^^^ markup.list.unnumbered.markdown + +## https://spec.commonmark.org/0.30/#example-263 + +1. foo + + ``` + | <- markup.list.numbered.markdown meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown + bar + | <- markup.list.numbered.markdown markup.raw.code-fence.markdown-gfm - punctuation + ``` + | <- markup.list.numbered.markdown meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown + + baz + | <- markup.list.numbered.markdown + + > bam + | <- markup.list.numbered.markdown markup.quote.markdown punctuation.definition.blockquote.markdown + |^^^^^ markup.list.numbered.markdown markup.quote.markdown + +## https://spec.commonmark.org/0.30/#example-265 + +Note that ordered list start numbers must be nine digits or less: + +123456789. ok +| <- markup.list.numbered.bullet.markdown +|^^^^^^^^^ markup.list.numbered.bullet.markdown +| ^^^^ markup.list.numbered.markdown + +## https://spec.commonmark.org/0.30/#example-266 + +1234567890. not ok +| <- meta.paragraph.markdown - markup.list +|^^^^^^^^^^^^^^^^^^ meta.paragraph.markdown - markup.list + +## https://spec.commonmark.org/0.30/#example-267 + +0. ok +| <- markup.list.numbered.bullet.markdown +|^ markup.list.numbered.bullet.markdown punctuation.definition.list_item.markdown +| ^^^^ markup.list.numbered.markdown + +## https://spec.commonmark.org/0.30/#example-268 + +003. ok +| <- markup.list.numbered.bullet.markdown +|^^^ markup.list.numbered.bullet.markdown +| ^ punctuation.definition.list_item.markdown +| ^^^^ markup.list.numbered.markdown + +## https://spec.commonmark.org/0.30/#example-269 + +-1. not ok +| <- meta.paragraph.markdown - markup.list +|^^^^^^^^^^ meta.paragraph.markdown - markup.list + +## https://spec.commonmark.org/0.30/#example-282 + +- foo +- +| <- markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown +|^^^^ markup.list.unnumbered.markdown + +- foo +- +- bar +| <- markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown +|^^^^ markup.list.unnumbered.markdown + +## https://spec.commonmark.org/0.30/#example-283 + +1. foo +2. +| <- markup.list.numbered.bullet.markdown +|^ markup.list.numbered.bullet.markdown punctuation.definition.list_item.markdown +| ^ markup.list.numbered.markdown - punctuation + +1. foo +2. +3. bar +| <- markup.list.numbered.bullet.markdown +|^ markup.list.numbered.bullet.markdown punctuation.definition.list_item.markdown +| ^^^^^ markup.list.numbered.markdown - punctuation + +## https://spec.commonmark.org/0.30/#example-284 + +* +| <- markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown +|^ markup.list.unnumbered.markdown - punctuation + +## https://spec.commonmark.org/0.30/#example-285 + +foo +* +| <- markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown +|^ markup.list.unnumbered.markdown - punctuation + +foo +1. +| <- markup.list.numbered.bullet.markdown +|^ markup.list.numbered.bullet.markdown punctuation.definition.list_item.markdown +| ^ markup.list.numbered.markdown - punctuation + +## https://spec.commonmark.org/0.30/#example-286 + + 1. A paragraph + with two lines. + |^^^^^^^^^^^^^^^ markup.list.numbered.markdown + + indented code (but ST can't reliably highlight it!) + |^^^^^^^^^^^^^^^^^^^ markup.list.numbered.markdown - markup.raw + + > A block quote. + |^^^^^^^^^^^^^^^^ markup.list.numbered.markdown markup.quote.markdown + +## https://spec.commonmark.org/0.30/#example-287 + + 1. A paragraph + with two lines. + |^^^^^^^^^^^^^^^ markup.list.numbered.markdown + + indented code (but ST can't reliably highlight it!) + |^^^^^^^^^^^^^^^^^^^ markup.list.numbered.markdown - markup.raw + + > A block quote. + | ^^^^^^^^^^^^^^^^^ markup.list.numbered.markdown markup.quote.markdown + +## https://spec.commonmark.org/0.30/#example-288 + + 1. A paragraph + with two lines. + |^^^^^^^^^^^^^^^ markup.list.numbered.markdown + + indented code (but ST can't reliably highlight it!) + |^^^^^^^^^^^^^^^^^^^ markup.list.numbered.markdown - markup.raw + + > A block quote. + |^^^^^^^^^^^^^^^^ markup.list.numbered.markdown markup.quote.markdown + +## https://spec.commonmark.org/0.30/#example-289 + + 1. A paragraph + with two lines. + |^^^^^^^^^^^^^^^ markup.raw.block.markdown - markup.list + + indented code + |^^^^^^^^^^^^^^^^^ markup.raw.block.markdown - markup.list + + > A block quote. + |^^^^^^^^^^^^^^^^ markup.raw.block.markdown - markup.list + +## https://spec.commonmark.org/0.30/#example-290 + + 1. A paragraph +with two lines. +| <- markup.list.numbered.markdown +|^^^^^^^^^^^^^^^ markup.list.numbered.markdown + + indented code (but ST can't reliably highlight it!) + |^^^^^^^^^^^^^^^^^ markup.list.numbered.markdown - markup.raw + + > A block quote. + | ^^^^^^^^^^^^^^^^^ markup.list.numbered.markdown markup.quote.markdown + +## https://spec.commonmark.org/0.30/#example-291 + + 1. A paragraph + with two lines. + |^^^^^^^^^^^^^^^ markup.list.numbered.markdown + +## https://spec.commonmark.org/0.30/#example-292 + +> 1. > Blockquote > text +| ^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.numbered.markdown +| ^ punctuation.definition.blockquote.markdown +| ^ - punctuation + +> 1. > Blockquote +continued here. +| <- markup.quote.markdown markup.list.numbered.markdown +|^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.numbered.markdown + +## https://spec.commonmark.org/0.30/#example-293 + +> 1. > Blockquote +> continued here. +| <- markup.quote.markdown markup.list.numbered.markdown punctuation.definition.blockquote.markdown +|^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.list.numbered.markdown + +## https://spec.commonmark.org/0.30/#example-294 + +So, in this case we need two spaces indent: + +- foo + - bar + - baz + - boo +| <- markup.list.unnumbered.markdown +|^^^^^ markup.list.unnumbered.markdown +| ^ markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown +| ^^^^^ markup.list.unnumbered.markdown + +## https://spec.commonmark.org/0.30/#example-295 + +One is not enough: + +- foo + - bar + - baz + - boo +| <- markup.list.unnumbered.markdown +|^^ markup.list.unnumbered.markdown +| ^ markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown +| ^^^^^ markup.list.unnumbered.markdown + +## https://spec.commonmark.org/0.30/#example-296 + +Here we need four, because the list marker is wider: + +10) foo + - bar +| <- markup.list.numbered.markdown +|^^^ markup.list.numbered.markdown +| ^ markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown +| ^^^^^ markup.list.numbered.markdown + +## https://spec.commonmark.org/0.30/#example-297 + +Three is not enough: + +10) foo + - bar +| <- markup.list.numbered.markdown +|^^ markup.list.numbered.markdown +| ^ markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown +| ^^^^^ markup.list.numbered.markdown + +## https://spec.commonmark.org/0.30/#example-298 + +A list may be the first block in a list item: + +- - foo +| <- markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown +|^ markup.list.unnumbered.markdown +| ^ markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown +| ^^^^^ markup.list.unnumbered.markdown + +## https://spec.commonmark.org/0.30/#example-299 + +A list may be the first block in a list item: + +1. - 2. foo 3. bar +| <- markup.list.numbered.bullet.markdown +|^ markup.list.numbered.bullet.markdown punctuation.definition.list_item.markdown +| ^ markup.list.numbered.markdown +| ^ markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown +| ^ markup.list.unnumbered.markdown +| ^^ markup.list.numbered.bullet.markdown +| ^^^^^^^^^^^^^ markup.list.numbered.markdown - punctuation + +## https://spec.commonmark.org/0.30/#example-300 + +A list item can contain a heading: + +- # Foo +| <- markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown +|^^^^^^^ markup.list.unnumbered.markdown +| ^^^^^^ markup.heading.1.markdown +| ^ punctuation.definition.heading.begin.markdown +| ^^^ entity.name.section.markdown + + +- Should be a setext heading! + --- +| ^^^ markup.list.unnumbered.markdown meta.separator.thematic-break.markdown punctuation.definition.thematic-break.markdown + +- Bar + --- + baz +| <- markup.list.unnumbered.markdown +|^^^^^ markup.list.unnumbered.markdown + +## https://spec.commonmark.org/0.30/#example-301 + +Changing the bullet or ordered list delimiter starts a new list: + +- foo +- bar ++ baz +| <- markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown +|^^^^^ markup.list.unnumbered.markdown + +## https://spec.commonmark.org/0.30/#example-302 + +Changing the bullet or ordered list delimiter starts a new list: + +1. foo +2. bar +3) baz +| <- markup.list.numbered.bullet.markdown +|^ markup.list.numbered.bullet.markdown punctuation.definition.list_item.markdown +| ^^^^^ markup.list.numbered.markdown + +## https://spec.commonmark.org/0.30/#example-303 + +In CommonMark, a list can interrupt a paragraph. +That is, no blank line is needed to separate a paragraph from a following list: + +Foo +- bar +| <- markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown + +Foo +- bar +- baz +| <- markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown + +## https://spec.commonmark.org/0.30/#example-304 + +In order to solve of unwanted lists in paragraphs with hard-wrapped numerals, +we allow only lists starting with 1 to interrupt paragraphs. + +The number of windows in my house is +14. The number of doors is 6. +| <- meta.paragraph.markdown - markup.list +|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.paragraph.markdown - markup.list + +## https://spec.commonmark.org/0.30/#example-305 + +We may still get an unintended result in cases like + +The number of windows in my house is +1. The number of doors is 6. +| <- markup.list.numbered.bullet.markdown +|^ markup.list.numbered.bullet.markdown punctuation.definition.list_item.markdown +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.list.numbered.markdown + +## https://spec.commonmark.org/0.30/#example-306 + +There can be any number of blank lines between items: + +- foo + +- bar + |^^^ markup.list.unnumbered.markdown + + +- baz + |^^^ markup.list.unnumbered.markdown + +## https://spec.commonmark.org/0.30/#example-307 + +- foo + - bar + - baz + + + bim + |^^^ markup.list.unnumbered.markdown - markup.raw + +## https://spec.commonmark.org/0.30/#example-308 + +To separate consecutive lists of the same type, +you can insert a blank HTML comment: + +- foo +- bar + + +| <- meta.disable-markdown comment.block.html +|^^^^^^^ meta.disable-markdown comment.block.html + +- baz +- bim + +## https://spec.commonmark.org/0.30/#example-309 + +To separate a list from an indented code block that would otherwise +be parsed as a subparagraph of the final list item, +you can insert a blank HTML comment: + +- foo + + notcode + |^^^^^^^ markup.list.unnumbered.markdown - markup.raw + +- foo + + + + code + |^^^^ markup.raw.block.markdown - markup.list + +## https://spec.commonmark.org/0.30/#example-311 + +List items need not be indented to the same level. + +1. a + | <- markup.list.numbered.markdown - markup.raw + + 2. b + | <- markup.list.numbered.markdown - markup.raw + + 3. c + | <- markup.list.numbered.markdown - markup.raw + +1) a + | <- markup.list.numbered.markdown - markup.raw + + 2) b + | <- markup.list.numbered.markdown - markup.raw + + 3) c + | <- markup.list.numbered.markdown - markup.raw + +## https://spec.commonmark.org/0.30/#example-313 + +And here, `3. c` should be treated as in indented code block, +because it is indented four spaces and preceded by a blank line. + +1. a + | <- markup.list.numbered.markdown - markup.raw + + 2. b + | <- markup.list.numbered.markdown - markup.raw + + 3. c + | <- markup.list.numbered.markdown - markup.raw + +1) a + | <- markup.list.numbered.markdown - markup.raw + + 2) b + | <- markup.list.numbered.markdown - markup.raw + + 3) c + | <- markup.list.numbered.markdown - markup.raw + +> Note: ST's syntax engine and the implementation of this syntax don't support that. + +## https://spec.commonmark.org/0.30/#example-314 + +This is a loose list, because there is a blank line between two of the list items: + +- a +- b + +- c +| <- markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown +|^^^ markup.list.unnumbered.markdown + +## https://spec.commonmark.org/0.30/#example-315 + +So is this, with a empty second item: + +* a +* +| <- markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown +|^ markup.list.unnumbered.markdown +* c +| <- markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown +|^^^ markup.list.unnumbered.markdown + +## https://spec.commonmark.org/0.30/#example-317 + +- a +- b [ref] + | ^^^^^ markup.list.unnumbered.markdown meta.link.reference.description.markdown + + [ref]: /url + | <- markup.list.unnumbered.markdown meta.link.reference.def.markdown punctuation.definition.reference.begin.markdown + |^^^^^^^^^^^ markup.list.unnumbered.markdown meta.link.reference.def.markdown + |^^^ entity.name.reference.link.markdown + | ^ punctuation.definition.reference.end.markdown + | ^ punctuation.separator.key-value.markdown + | ^^^^ markup.underline.link.markdown +- d + | <- markup.list.unnumbered.markdown + +## https://spec.commonmark.org/0.30/#example-318 + +- a +- ``` + | <- markup.list.unnumbered.markdown meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown + |^^ markup.list.unnumbered.markdown meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown + b + | <- markup.list.unnumbered.markdown markup.raw.code-fence.markdown-gfm + + + ``` + | <- markup.list.unnumbered.markdown meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown + |^^ markup.list.unnumbered.markdown meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown + +- a +- ``` + b + + + ``` +- c + | <- markup.list.unnumbered.markdown - markup.raw + +## https://spec.commonmark.org/0.30/#example-319 + +- a + - b + + c + | <- markup.list.unnumbered.markdown +- d + | <- markup.list.unnumbered.markdown + +## https://spec.commonmark.org/0.30/#example-320 + +* a + > b + > + | <- markup.list.unnumbered.markdown markup.quote.markdown punctuation.definition.blockquote.markdown + |^ markup.list.unnumbered.markdown markup.quote.markdown - punctuation + +* a + > b + > +* c + | <- markup.list.unnumbered.markdown + +## https://spec.commonmark.org/0.30/#example-321 + +- a + > b + ``` + | <- markup.list.unnumbered.markdown meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown + |^^ markup.list.unnumbered.markdown meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown + c + ``` + | <- markup.list.unnumbered.markdown meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown + |^^ markup.list.unnumbered.markdown meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown + +- a + > b + ``` + c + ``` +- d + | <- markup.list.unnumbered.markdown + +## https://spec.commonmark.org/0.30/#example-324 + +1. ``` + | <- markup.list.numbered.markdown meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown + |^^ markup.list.numbered.markdown meta.code-fence.definition.begin.text.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown + foo + | <- markup.list.numbered.markdown markup.raw.code-fence.markdown-gfm + ``` + | <- markup.list.numbered.markdown meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown + |^^ markup.list.numbered.markdown meta.code-fence.definition.end.text.markdown-gfm punctuation.definition.raw.code-fence.end.markdown + + bar + | <- markup.list.numbered.markdown + +## https://spec.commonmark.org/0.30/#example-325 + +* foo + * bar + + baz + | <- markup.list.unnumbered.markdown + |^^^ markup.list.unnumbered.markdown + +## https://custom-tests/list-blocks/gfm-tasks + +* [ ] Unticked GitHub-flavored-markdown checkbox +| ^ markup.checkbox.begin.markdown-gfm punctuation.definition.checkbox.begin.markdown-gfm +| ^ markup.checkbox.mark.markdown-gfm - punctuation +| ^ markup.checkbox.end.markdown-gfm punctuation.definition.checkbox.end.markdown-gfm + +* [x] Ticked GFM checkbox +| ^ markup.checkbox.begin.markdown-gfm punctuation.definition.checkbox.begin.markdown-gfm +| ^ markup.checkbox.mark.markdown-gfm - punctuation +| ^ markup.checkbox.end.markdown-gfm punctuation.definition.checkbox.end.markdown-gfm + +* [X] Another ticked checkbox +| ^ markup.checkbox.begin.markdown-gfm punctuation.definition.checkbox.begin.markdown-gfm +| ^ markup.checkbox.mark.markdown-gfm - punctuation +| ^ markup.checkbox.end.markdown-gfm punctuation.definition.checkbox.end.markdown-gfm + +* [X] Another ticked checkbox + + [ ] Sub-item with checkbox +| ^ markup.checkbox.begin.markdown-gfm punctuation.definition.checkbox.begin.markdown-gfm +| ^ markup.checkbox.mark.markdown-gfm - punctuation +| ^ markup.checkbox.end.markdown-gfm punctuation.definition.checkbox.end.markdown-gfm + +* [] Not a checkbox +| ^^ - markup.checkbox + +* [/] Not a checkbox +| ^^^ - markup.checkbox + +* Not [ ] a [x] checkbox [X] +| ^^^^^^^^^^^^^^^^^^^^^^^^^^ - markup.checkbox + +* [ ] [Checkbox][] with next word linked +| ^ markup.checkbox.begin.markdown-gfm punctuation.definition.checkbox.begin.markdown-gfm +| ^ markup.checkbox.mark.markdown-gfm - punctuation +| ^ markup.checkbox.end.markdown-gfm punctuation.definition.checkbox.end.markdown-gfm +| ^^^^^^^^^^^^ meta.link + +## https://custom-tests/list-blocks/items-with-thematic-breaks + +- * * * * * * * +| <- markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown +| ^^^^^^^^^^^^^^ markup.list.unnumbered.markdown meta.separator.thematic-break.markdown +| ^ punctuation.definition.thematic-break +| ^ - punctuation +| ^ punctuation.definition.thematic-break +| ^ - punctuation +| ^ punctuation.definition.thematic-break +| ^ - punctuation +| ^ punctuation.definition.thematic-break +| ^ - punctuation +| ^ punctuation.definition.thematic-break +| ^ - punctuation +| ^ punctuation.definition.thematic-break +| ^ - punctuation +| ^ punctuation.definition.thematic-break +| ^ - punctuation + +- * * * * * * * + still a list item +| ^^^^^^^^^^^^^^^^^^ markup.list.unnumbered + +- - * * * * * * +| <- markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown +| ^ markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown +| ^ - punctuation +| ^^^^^^^^^^^^ markup.list.unnumbered.markdown meta.separator.thematic-break.markdown +| ^ punctuation.definition.thematic-break +| ^ - punctuation +| ^ punctuation.definition.thematic-break +| ^ - punctuation +| ^ punctuation.definition.thematic-break +| ^ - punctuation +| ^ punctuation.definition.thematic-break +| ^ - punctuation +| ^ punctuation.definition.thematic-break +| ^ - punctuation +| ^ punctuation.definition.thematic-break +| ^ - punctuation + +- - * * * * * * + still a list item +| ^^^^^^^^^^^^^^^^^^ markup.list.unnumbered + +1. * * * * * * * +| <- markup.list.numbered.bullet.markdown +| ^^^^^^^^^^^^^^ markup.list.numbered.markdown meta.separator.thematic-break.markdown +| ^ punctuation.definition.thematic-break +| ^ - punctuation +| ^ punctuation.definition.thematic-break +| ^ - punctuation +| ^ punctuation.definition.thematic-break +| ^ - punctuation +| ^ punctuation.definition.thematic-break +| ^ - punctuation +| ^ punctuation.definition.thematic-break +| ^ - punctuation +| ^ punctuation.definition.thematic-break +| ^ - punctuation +| ^ punctuation.definition.thematic-break +| ^ - punctuation + +1. * * * * * * * + still a list item +| ^^^^^^^^^^^^^^^^^^ markup.list.numbered + +## https://custom-tests/list-blocks/items-with-atx-headings + +* list item +# global heading +| <- markup.heading.1.markdown punctuation.definition.heading.begin.markdown - markup.list +|^^^^^^^^^^^^^^^^ markup.heading.1.markdown - markup.list + +* list item + # global heading (matched as list item heading) + | <- markup.list.unnumbered.markdown markup.heading.1.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.list.unnumbered.markdown markup.heading.1.markdown + +* list item + # list item heading + | <- markup.list.unnumbered.markdown markup.heading.1.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^ markup.list.unnumbered.markdown markup.heading.1.markdown +* list item + ## list item heading + | <- markup.list.unnumbered.markdown markup.heading.2.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^^ markup.list.unnumbered.markdown markup.heading.2.markdown + + list item + ### list item heading + | <- markup.list.unnumbered.markdown markup.heading.3.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^^^ markup.list.unnumbered.markdown markup.heading.3.markdown + + list item + #### list item heading + | <- markup.list.unnumbered.markdown markup.heading.4.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^^^^ markup.list.unnumbered.markdown markup.heading.4.markdown + +* + # list item heading + | <- markup.list.unnumbered.markdown markup.heading.1.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^ markup.list.unnumbered.markdown markup.heading.1.markdown + + + # list item heading + | <- markup.list.unnumbered.markdown markup.heading.1.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^ markup.list.unnumbered.markdown markup.heading.1.markdown + - + # list item heading 1 + | <- markup.list.unnumbered.markdown markup.heading.1.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^^^ markup.list.unnumbered.markdown markup.heading.1.markdown + + ## list item heading 2 + | <- markup.list.unnumbered.markdown markup.heading.2.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^^^^ markup.list.unnumbered.markdown markup.heading.2.markdown + +* + + # list item heading + | <- markup.list.unnumbered.markdown markup.heading.1.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^ markup.list.unnumbered.markdown markup.heading.1.markdown + + + + + # list item heading + | <- markup.list.unnumbered.markdown markup.heading.1.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^ markup.list.unnumbered.markdown markup.heading.1.markdown + + - + + # list item heading 1 + | <- markup.list.unnumbered.markdown markup.heading.1.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^^^ markup.list.unnumbered.markdown markup.heading.1.markdown + + ## list item heading 2 + | <- markup.list.unnumbered.markdown markup.heading.2.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^^^^ markup.list.unnumbered.markdown markup.heading.2.markdown + +1. list item +# global heading +| <- markup.heading.1.markdown punctuation.definition.heading.begin.markdown - markup.list +|^^^^^^^^^^^^^^^^ markup.heading.1.markdown - markup.list + +2. list item + # global heading (matched as list item heading) + | <- markup.list.numbered.markdown markup.heading.1.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.list.numbered.markdown markup.heading.1.markdown + +3. list item + # list item heading + | <- markup.list.numbered.markdown markup.heading.1.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^ markup.list.numbered.markdown markup.heading.1.markdown + 1. list item + # list item heading + | <- markup.list.numbered.markdown markup.heading.1.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^ markup.list.numbered.markdown markup.heading.1.markdown + 1. list item + # list item heading + | <- markup.list.numbered.markdown markup.heading.1.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^ markup.list.numbered.markdown markup.heading.1.markdown + 2. list item + # list item heading + | <- markup.list.numbered.markdown markup.heading.1.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^ markup.list.numbered.markdown markup.heading.1.markdown + 1. list item + # list item heading + | <- markup.list.numbered.markdown markup.heading.1.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^ markup.list.numbered.markdown markup.heading.1.markdown + +1. + # list item heading + | <- markup.list.numbered.markdown markup.heading.1.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^ markup.list.numbered.markdown markup.heading.1.markdown + 1. + # list item heading + | <- markup.list.numbered.markdown markup.heading.1.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^ markup.list.numbered.markdown markup.heading.1.markdown + 1. + # list item heading + | <- markup.list.numbered.markdown markup.heading.1.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^ markup.list.numbered.markdown markup.heading.1.markdown + + ## list item heading 2 + | <- markup.list.numbered.markdown markup.heading.2.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^^^^ markup.list.numbered.markdown markup.heading.2.markdown + +1. + + # list item heading + | <- markup.list.numbered.markdown markup.heading.1.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^ markup.list.numbered.markdown markup.heading.1.markdown + + 1. + + # list item heading + | <- markup.list.numbered.markdown markup.heading.1.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^ markup.list.numbered.markdown markup.heading.1.markdown + + 1. + + # list item heading 1 + | <- markup.list.numbered.markdown markup.heading.1.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^^^ markup.list.numbered.markdown markup.heading.1.markdown + + ## list item heading 2 + | <- markup.list.numbered.markdown markup.heading.2.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^^^^^^^^^^^^^^ markup.list.numbered.markdown markup.heading.2.markdown + +## https://custom-tests/list-blocks/items-with-fenced-code-blocks-indented-by-tabs + + * foo + ```xml +|^^^ markup.list.unnumbered.markdown meta.code-fence.definition.begin.xml.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown +| ^^ markup.list.unnumbered.markdown meta.code-fence.definition.begin.xml.markdown-gfm constant.other.language-name.markdown + +|^^^^^ markup.list.unnumbered.markdown markup.raw.code-fence.xml.markdown-gfm text.xml meta.tag.xml + ``` +|^^^ markup.list.unnumbered.markdown meta.code-fence.definition.end.xml.markdown-gfm punctuation.definition.raw.code-fence.end.markdown + +## https://custom-tests/list-blocks/items-with-html-blocks + +* list item + +

*no-markdown*

+ |^^^^^^^^^^^^^^^^^^^ markup.list.unnumbered.markdown meta.disable-markdown - meta.paragraph + | ^^^^ meta.tag + + + sub item + +

*no-markdown*

+ |^^^^^^^^^^^^^^^^^^^ markup.list.unnumbered.markdown meta.disable-markdown - meta.paragraph + | ^^^^ meta.tag + + + | <- markup.list.unnumbered.markdown meta.disable-markdown meta.tag.style.end.html punctuation.definition.tag.begin.html + |^^^^^^^ markup.list.unnumbered.markdown meta.disable-markdown meta.tag.style.end.html + | ^ markup.list.unnumbered.markdown meta.disable-markdown - mata.tag + + Further sub item text. + | <- markup.list.unnumbered.markdown + |^^^^^^^^^^^^^^^^^^^^^ markup.list.unnumbered.markdown + + + sub item +

+ | <- markup.list.unnumbered.markdown meta.disable-markdown meta.tag + |^^ markup.list.unnumbered.markdown meta.disable-markdown meta.tag + *no-markodwn* + |^^^^^^^^^^^^^^^ markup.list.unnumbered.markdown meta.disable-markdown - markup.italic +

+ - not a list item + | <- markup.list.unnumbered.markdown meta.disable-markdown - punctuation + |^^^^^^^^^^^^^^^^^ markup.list.unnumbered.markdown meta.disable-markdown - punctuation + +## https://custom-tests/list-blocks/items-with-reference-definitions + +* list item [ref] + | ^^^^^ markup.list.unnumbered.markdown meta.link.reference.description.markdown + + + sub item [ref] + | ^^^^^ markup.list.unnumbered.markdown meta.link.reference.description.markdown + + [ref]: /url + | <- markup.list.unnumbered.markdown meta.link.reference.def.markdown punctuation.definition.reference.begin.markdown + |^^^^^^^^^^^ markup.list.unnumbered.markdown meta.link.reference.def.markdown + |^^^ entity.name.reference.link.markdown + | ^ punctuation.definition.reference.end.markdown + | ^ punctuation.separator.key-value.markdown + | ^^^^ markup.underline.link.markdown + + - sub item [ref] + | ^^^^^ markup.list.unnumbered.markdown meta.link.reference.description.markdown + + [ref]: /url + | <- markup.list.unnumbered.markdown meta.link.reference.def.markdown punctuation.definition.reference.begin.markdown + |^^^^^^^^^^^ markup.list.unnumbered.markdown meta.link.reference.def.markdown + |^^^ entity.name.reference.link.markdown + | ^ punctuation.definition.reference.end.markdown + | ^ punctuation.separator.key-value.markdown + | ^^^^ markup.underline.link.markdown + + [ref]: + /url + | <- markup.list.unnumbered.markdown meta.link.reference.def.markdown markup.underline.link.markdown + |^^^ markup.list.unnumbered.markdown meta.link.reference.def.markdown markup.underline.link.markdown + + [ref]: /url + "title" + | <- markup.list.unnumbered.markdown meta.link.reference.def.markdown meta.string.title.markdown string.quoted.double.markdown + |^^^^^^ markup.list.unnumbered.markdown meta.link.reference.def.markdown meta.string.title.markdown string.quoted.double.markdown + + [ref]: /url + no title + | <- markup.list.unnumbered.markdown meta.paragraph.list.markdown - meta.link + |^^^^^^^^ markup.list.unnumbered.markdown meta.paragraph.list.markdown - meta.link + + [ref]: /url + | <- markup.list.unnumbered.markdown meta.link.reference.def.markdown punctuation.definition.reference.begin.markdown + |^^^^^^^^^^^ markup.list.unnumbered.markdown meta.link.reference.def.markdown + |^^^ entity.name.reference.link.markdown + | ^ punctuation.definition.reference.end.markdown + | ^ punctuation.separator.key-value.markdown + | ^^^^ markup.underline.link.markdown + +1. list item [ref] + | ^^^^^ markup.list.numbered.markdown meta.link.reference.description.markdown + + 2. sub item [ref] + | ^^^^^ markup.list.numbered.markdown meta.link.reference.description.markdown + + [ref]: /url + | <- markup.list.numbered.markdown meta.link.reference.def.markdown punctuation.definition.reference.begin.markdown + |^^^^^^^^^^^ markup.list.numbered.markdown meta.link.reference.def.markdown + |^^^ entity.name.reference.link.markdown + | ^ punctuation.definition.reference.end.markdown + | ^ punctuation.separator.key-value.markdown + | ^^^^ markup.underline.link.markdown + + 3. sub item [ref] + | ^^^^^ markup.list.numbered.markdown meta.link.reference.description.markdown + + [ref]: /url + | <- markup.list.numbered.markdown meta.link.reference.def.markdown punctuation.definition.reference.begin.markdown + |^^^^^^^^^^^ markup.list.numbered.markdown meta.link.reference.def.markdown + |^^^ entity.name.reference.link.markdown + | ^ punctuation.definition.reference.end.markdown + | ^ punctuation.separator.key-value.markdown + | ^^^^ markup.underline.link.markdown + + [ref]: + /url + | <- markup.list.numbered.markdown meta.link.reference.def.markdown markup.underline.link.markdown + |^^^ markup.list.numbered.markdown meta.link.reference.def.markdown markup.underline.link.markdown + + [ref]: /url + "title" + | <- markup.list.numbered.markdown meta.link.reference.def.markdown meta.string.title.markdown string.quoted.double.markdown + |^^^^^^ markup.list.numbered.markdown meta.link.reference.def.markdown meta.string.title.markdown string.quoted.double.markdown + + [ref]: /url + no title + | <- markup.list.numbered.markdown meta.paragraph.list.markdown - meta.link + |^^^^^^^^ markup.list.numbered.markdown meta.paragraph.list.markdown - meta.link + + [ref]: /url + | <- markup.list.numbered.markdown meta.link.reference.def.markdown punctuation.definition.reference.begin.markdown + |^^^^^^^^^^^ markup.list.numbered.markdown meta.link.reference.def.markdown + |^^^ entity.name.reference.link.markdown + | ^ punctuation.definition.reference.end.markdown + | ^ punctuation.separator.key-value.markdown + | ^^^^ markup.underline.link.markdown + +## https://custom-tests/list-blocks/items-with-footnote-definitions + +1. list item + + sub item + - sub item [^1] + + [^1]: + This is a foot note + with a second line +| <- markup.list.numbered.markdown meta.link.reference.def.footnote.markdown-extra +|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.list.numbered.markdown meta.link.reference.def.footnote.markdown-extra + +1. list item + + sub item + - sub item [^1] + + [^1]: + This is a foot note + with a second line + [^2]: + ^^^^^^ markup.list.numbered.markdown meta.link.reference.def.footnote.markdown-extra + ^ punctuation.definition.reference.begin.markdown + ^^ entity.name.reference.link.markdown + ^ punctuation.definition.reference.end.markdown + ^ punctuation.separator.key-value.markdown + +1. list item + + sub item + - sub item [^1] + + [^1]: + This is a foot note + with a second line + # header +|^^^^^^^^^^^^^^^ markup.list.numbered.markdown markup.heading.1.markdown + +1. list item + + sub item + - sub item [^1] + + [^1]: + This is a foot note + with a second line + - sub item +|^^^^^^^^^^^^^^ markup.list.numbered.markdown +| ^ markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown + +## https://custom-tests/list-blocks/items-with-line-continuation + +* list item +second line +| <- markup.list.unnumbered.markdown + + subitem +second line +| <- markup.list.unnumbered.markdown + - subitem +second line +| <- markup.list.unnumbered.markdown + - subitem +second line +| <- markup.list.unnumbered.markdown + +paragraph +| <- meta.paragraph.markdown + +1. list item +second line +| <- markup.list.numbered.markdown + 2. subitem +second line +| <- markup.list.numbered.markdown + 3. subitem +second line +| <- markup.list.numbered.markdown + 4. subitem +second line +| <- markup.list.numbered.markdown + +paragraph +| <- meta.paragraph.markdown + +1. list item +second line +| <- markup.list.numbered.markdown + + subitem +second line +| <- markup.list.numbered.markdown + - subitem +second line +| <- markup.list.numbered.markdown + - subitem +second line +| <- markup.list.numbered.markdown + +paragraph +| <- meta.paragraph.markdown + +## https://custom-tests/list-blocks/items-with-block-quotes/basics + +* list item + + > This is a blockquote. + | <- markup.list.unnumbered markup.quote punctuation.definition.blockquote + + + subitem + + > This is a blockquote. + | <- markup.list.unnumbered markup.quote punctuation.definition.blockquote + + - subitem + + > This is a blockquote. + | <- markup.list.unnumbered markup.quote punctuation.definition.blockquote + + - subitem + + > This is a blockquote. + | <- markup.list.unnumbered markup.quote punctuation.definition.blockquote + + This is a paragraph still part of the + list item + |^^^^^^^^^^ markup.list.unnumbered.markdown - meta.paragraph meta.paragraph + +1. list item + + > This is a blockquote. + | <- markup.list.numbered.markdown markup.quote.markdown punctuation.definition.blockquote.markdown + + 2. subitem + + > This is a blockquote. + | <- markup.list.numbered.markdown markup.quote.markdown punctuation.definition.blockquote.markdown + + 3. subitem + + > This is a blockquote. + | <- markup.list.numbered.markdown markup.quote.markdown punctuation.definition.blockquote.markdown + + This is a paragraph still part of the + list item + |^^^^^^^^^ markup.list.numbered.markdown - meta.paragraph meta.paragraph + +## https://custom-tests/list-blocks/items-with-block-quotes/block-quote-terminations + +1. item + + item + - item + > Block quote followed by heading + # heading + | <- markup.heading.1.markdown punctuation.definition.heading.begin.markdown + |^^^^^^^^^ markup.heading.1.markdown - meta.quote + | ^^^^^^^ entity.name.section.markdown + + > Block quote followed by unordered list + * list item + | <- markup.list.numbered.markdown markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown + |^^^^^^^^^^^ markup.list.numbered.markdown - meta.quote + + > Block quote followed by unordered list + + list item + | <- markup.list.numbered.markdown markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown + |^^^^^^^^^^^ markup.list.numbered.markdown - meta.quote + + > Block quote followed by unordered list + - list item + | <- markup.list.numbered.markdown markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown + |^^^^^^^^^^^ markup.list.numbered.markdown - meta.quote + + > Block quote followed by ordered list + 1. list item + | <- markup.list.numbered.markdown markup.list.numbered.bullet.markdown + |^ markup.list.numbered.markdown markup.list.numbered.bullet.markdown punctuation.definition.list_item.markdown + | ^^^^^^^^^^ markup.list.numbered.markdown - meta.quote + + > Block quote followed by ordered list + 2. list item + | <- markup.list.numbered.bullet.markdown - punctuation + |^ markup.list.numbered.bullet.markdown punctuation.definition.list_item.markdown + | ^^^^^^^^^^ markup.list.numbered.markdown - meta.quote + + > Block quote followed by invalid list + 1234567890. no list item + | <- markup.list.numbered.markdown markup.quote.markdown markup.paragraph.markdown + |^^^^^^^^^^^^^^^^^^^^^^^^ markup.list.numbered.markdown markup.quote.markdown markup.paragraph.markdown + + > Block quote followed by html block +

*no-markdown

+ | <- meta.disable-markdown meta.tag.block + |^^^^^^^^^^^^^^^^^^^ meta.disable-markdown + +## https://custom-tests/list-blocks/items-with-block-quotes/headings-and-paragraphs + +1. item + + item + - item + > # Foo + | <- markup.quote.markdown punctuation.definition.blockquote.markdown + |^ markup.quote.markdown - markup.heading + | ^^^^^^ markup.quote.markdown markup.heading.1.markdown + | ^ punctuation.definition.heading.begin.markdown + | ^^^ entity.name.section.markdown + + > # Foo + bar + | <- meta.paragraph.list.markdown - markup.quote + |^^ meta.paragraph.list.markdown - markup.quote + + > # Foo + > bar + | <- markup.quote.markdown punctuation.definition.blockquote.markdown + |^^^^^ markup.quote.markdown + + > # Foo + > bar + > baz + | <- markup.quote.markdown punctuation.definition.blockquote.markdown + |^^^^^ markup.quote.markdown + + ># Foo + | <- markup.quote.markdown punctuation.definition.blockquote.markdown + |^^^^^^ markup.quote.markdown markup.heading.1.markdown + |^ punctuation.definition.heading.begin.markdown + | ^^^ entity.name.section.markdown + + ># Foo + >bar + | <- markup.quote.markdown punctuation.definition.blockquote.markdown + |^^^^ markup.quote.markdown + + ># Foo + >bar + > baz + | <- markup.quote.markdown punctuation.definition.blockquote.markdown + |^^^^^ markup.quote.markdown + +## https://custom-tests/list-blocks/items-with-block-quotes/paragraphs-vs-codeblocks + +1. item + + item + - item + >foo 1 + >foo 2 + |^^^^^^ markup.list.numbered.markdown markup.quote.markdown markup.paragraph.markdown + + > foo 1 + > foo 2 + | ^^^^^^ markup.list.numbered.markdown markup.quote.markdown markup.paragraph.markdown + + > foo 1 + > foo 2 + | ^^^^^^^ markup.list.numbered.markdown markup.quote.markdown markup.paragraph.markdown + + > foo 1 + > foo 2 + | ^^^^^^^^ markup.list.numbered.markdown markup.quote.markdown markup.paragraph.markdown + + > foo 1 + > foo 2 + | ^^^^^^^^^^^^ markup.list.numbered.markdown markup.quote.markdown markup.raw.block.markdown + +## https://custom-tests/list-blocks/items-with-nested-block-quotes + +1. item + + item + - item + > > Nested block quote + | <- markup.quote punctuation.definition.blockquote + | ^^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown + |^ - punctuation + | ^ punctuation.definition.blockquote + | ^ - punctuation + + > > Nested quote + > Followed by more quoted text that is not nested + | <- markup.quote punctuation.definition.blockquote - markup.quote markup.quote + + > > this is a nested quote but no code in a block quote + | <- punctuation.definition.blockquote + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown + + > > this is a nested quote but no code in a block quote + > > with a second line of content + | <- punctuation.definition.blockquote + |^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.paragraph.markdown + | ^ - punctuation + + > > this is code in a block quote, not a nested quote + | <- punctuation.definition.blockquote + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.raw.block - markup.quote markup.quote + +## https://custom-tests/list-blocks/items-with-block-quotes/list-blocks + +1. item + + item + - item + > Block + > 1. item + | <- markup.list.numbered.markdown markup.quote.markdown punctuation.definition.blockquote.markdown + |^^^^^^^^^ markup.list.numbered.markdown markup.quote.markdown + | ^^ markup.list.numbered.bullet.markdown + + > Block + > 1. item + > + item + | <- markup.list.numbered.markdown markup.quote.markdown punctuation.definition.blockquote.markdown + |^^^^^^^^^^^ markup.list.numbered.markdown markup.quote.markdown markup.list.numbered.markdown + | ^ markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown + + > Block + > 1. item + > + item + > - item + | <- markup.list.numbered.markdown markup.quote.markdown punctuation.definition.blockquote.markdown + |^^^^^^^^^^^^^ markup.list.numbered.markdown markup.quote.markdown markup.list.numbered.markdown + | ^ markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown + + > Block + > 1. item + > + item + > - item + > > quote + > > quote + | <- markup.list.numbered.markdown markup.quote.markdown punctuation.definition.blockquote.markdown + |^^^^^^^^^^^^^^^^ markup.list.numbered.markdown markup.quote.markdown markup.list.numbered.markdown meta.paragraph.list.markdown + | ^ punctuation.definition.blockquote.markdown + + > Block + > 1. item + > + item + > - item + > # heading + | <- markup.list.numbered.markdown markup.quote.markdown markup.list.numbered.markdown markup.heading.1.markdown punctuation.definition.heading.begin.markdown + > # heading + | <- markup.list.numbered.markdown markup.quote.markdown punctuation.definition.blockquote.markdown + |^ markup.list.numbered.markdown markup.quote.markdown - markup.heading + | ^^^^^^^^^^ markup.list.numbered.markdown markup.quote.markdown markup.heading.1.markdown + | ^ punctuation.definition.heading.begin.markdown + | ^^^^^^^ entity.name.section.markdown + +## https://custom-tests/list-blocks/items-with-code-spans + +- `` | `` (foo/bar.baz) +- `` | `` | (foo/bar-baz.foo) +| <- markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.list.unnumbered.markdown - markup.table + +1. Open `Command Palette` using menu item `Tools → Command Palette...` + | ^^^^^^^^^^^^^^^^^ markup.list.numbered.markdown markup.raw.inline.markdown + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.list.numbered.markdown markup.raw.inline.markdown +2. Choose `Package Control: Install Package` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.list.numbered.markdown markup.raw.inline.markdown + +## https://custom-tests/list-blocks/items-with-emphasis + +- test *testing +blah* +| ^ markup.list.unnumbered markup.italic punctuation.definition.italic.end +- fgh +- *ghgh +| ^ markup.list.unnumbered markup.italic punctuation.definition.italic.begin +- fgfg +| <- markup.list.unnumbered.bullet punctuation.definition.list_item +- _test + +| <- markup.list.unnumbered markup.italic invalid.illegal.non-terminated.bold-italic + still a list item +| ^^^^^^^^^^^^^^^^^^ markup.list.unnumbered + +## https://custom-tests/list-blocks/items-with-inline-html-tags + +- `code` - +| <- markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown +|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.list.unnumbered.markdown +| ^^^^^^ markup.raw.inline.markdown +| ^ punctuation.definition.raw.begin.markdown +| ^ punctuation.definition.raw.end.markdown +| ^ - punctuation +| ^^^^^^^^^^^^^^^^^^^ meta.tag.inline.a.html + +- list item + + *no-markdown* + |^^^^^^^^^^^^^^^^^^^^^^^^^ markup.list.unnumbered.markdown meta.paragraph.list.markdown + | ^^^^^^^ meta.tag + + - list item + + *no-markdown* + |^^^^^^^^^^^^^^^^^^^^^^^^^ markup.list.unnumbered.markdown meta.paragraph.list.markdown + | ^^^^^^^ meta.tag + + - list item + + *no-markdown* + |^^^^^^^^^^^^^^^^^^^^^^^^^ markup.list.unnumbered.markdown meta.paragraph.list.markdown + | ^^^^^^^ meta.tag + +## https://custom-tests/list-blocks/items-with-links-and-references + + 1. [see `demo`](#demo "demo") + | <- markup.list.numbered.markdown meta.link.inline.description.markdown punctuation.definition.link.begin.markdown + |^^^^^^^^^^^ markup.list.numbered.markdown meta.link.inline.description.markdown + | ^^^^^^^^^^^^^^ markup.list.numbered.markdown meta.link.inline.metadata.markdown + | ^ punctuation.definition.metadata.begin.markdown + | ^ punctuation.definition.string.begin.markdown + | ^ punctuation.definition.string.end.markdown + | ^ punctuation.definition.metadata.end.markdown + + [see `demo`](#demo (demo)) + | <- markup.list.numbered.markdown meta.link.inline.description.markdown punctuation.definition.link.begin.markdown + |^^^^^^^^^^^ markup.list.numbered.markdown meta.link.inline.description.markdown + | ^^^^^^^^^^^^^^ markup.list.numbered.markdown meta.link.inline.metadata.markdown + | ^ punctuation.definition.metadata.begin.markdown + | ^ punctuation.definition.string.begin.markdown + | ^ punctuation.definition.string.end.markdown + | ^ punctuation.definition.metadata.end.markdown + + [see `demo`](#demo 'demo') + | <- markup.list.numbered.markdown meta.link.inline.description.markdown punctuation.definition.link.begin.markdown + |^^^^^^^^^^^ markup.list.numbered.markdown meta.link.inline.description.markdown + | ^^^^^^^^^^^^^^ markup.list.numbered.markdown meta.link.inline.metadata.markdown + | ^ punctuation.definition.metadata.begin.markdown + | ^ punctuation.definition.string.begin.markdown + | ^ punctuation.definition.string.end.markdown + | ^ punctuation.definition.metadata.end.markdown + + Here is a ![example image](https://test.com/sublime.png "A demonstration"). + | ^^^^^^^^^^^^^^^^ markup.list.numbered.markdown meta.image.inline.description.markdown + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.list.numbered.markdown meta.image.inline.metadata.markdown + | ^^ markup.list.numbered.markdown - meta.image + | ^^ punctuation.definition.image.begin.markdown + | ^ punctuation.definition.image.end.markdown + | ^ punctuation.definition.metadata.begin.markdown + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.image.markdown + | ^^^^^^^^^^^^^^^^^ string.quoted.double.markdown + | ^ punctuation.definition.string.begin.markdown + | ^ punctuation.definition.string.end.markdown + | ^ punctuation.definition.metadata.end.markdown + + Here is a ![example image](https://test.com/sublime.png 'A demonstration'). + | ^^^^^^^^^^^^^^^^ markup.list.numbered.markdown meta.image.inline.description.markdown + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.list.numbered.markdown meta.image.inline.metadata.markdown + | ^^ markup.list.numbered.markdown - meta.image + | ^^ punctuation.definition.image.begin.markdown + | ^ punctuation.definition.image.end.markdown + | ^ punctuation.definition.metadata.begin.markdown + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.image.markdown + | ^^^^^^^^^^^^^^^^^ string.quoted.single.markdown + | ^ punctuation.definition.string.begin.markdown + | ^ punctuation.definition.string.end.markdown + | ^ punctuation.definition.metadata.end.markdown + + Here is a ![example image](https://test.com/sublime.png (A demonstration)). + | ^^^^^^^^^^^^^^^^ markup.list.numbered.markdown meta.image.inline.description.markdown + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.list.numbered.markdown meta.image.inline.metadata.markdown + | ^^ markup.list.numbered.markdown - meta.image + | ^^ punctuation.definition.image.begin.markdown + | ^ punctuation.definition.image.end.markdown + | ^ punctuation.definition.metadata.begin.markdown + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.image.markdown + | ^^^^^^^^^^^^^^^^^ string.quoted.other.markdown + | ^ punctuation.definition.string.begin.markdown + | ^ punctuation.definition.string.end.markdown + | ^ punctuation.definition.metadata.end.markdown + + +# TEST: CODE SPANS ############################################################ + +```testing``123``` +| <- punctuation.definition.raw.begin +| ^^ - punctuation +| ^^^ punctuation.definition.raw.end + +```testing``123```` +| <- punctuation.definition.raw.begin +| ^ - punctuation +| ^^^^ - punctuation +``` +| <- punctuation.definition.raw.end + +``testing`123```` +| <- punctuation.definition.raw.begin +| ^ - punctuation +| ^^^^ - punctuation +more text`` +| ^^ punctuation.definition.raw.end + +``text + +| <- invalid.illegal.non-terminated.raw +text +| <- - markup.raw + +## https://spec.commonmark.org/0.30/#example-327 + +`hi`lo` +| <- markup.raw.inline.markdown punctuation.definition.raw.begin.markdown +|^^^ markup.raw.inline.markdown +| ^ punctuation.definition.raw.end.markdown +| ^^ - markup.raw + +## https://spec.commonmark.org/0.30/#example-328 + +`foo` +| <- markup.raw.inline.markdown punctuation.definition.raw.begin.markdown +|^^^^ meta.paragraph.markdown markup.raw.inline.markdown +| ^ punctuation.definition.raw.end.markdown + +## https://spec.commonmark.org/0.30/#example-329 + +`` foo ` bar `` +| <- markup.raw.inline.markdown punctuation.definition.raw.begin.markdown +|^^^^^^^^^^^^^^^ markup.raw.inline.markdown +|^ punctuation.definition.raw.begin.markdown +| ^ - punctuation +| ^^ punctuation.definition.raw.end.markdown + +## https://spec.commonmark.org/0.30/#example-330 + +` `` ` +| <- markup.raw.inline.markdown punctuation.definition.raw.begin.markdown +|^^^^^ markup.raw.inline.markdown +| ^^ - punctuation +| ^ punctuation.definition.raw.end.markdown + +## https://spec.commonmark.org/0.30/#example-331 + +` `` ` +| <- markup.raw.inline.markdown punctuation.definition.raw.begin.markdown +|^^^^^^^ markup.raw.inline.markdown +| ^^ - punctuation +| ^ punctuation.definition.raw.end.markdown + +## https://spec.commonmark.org/0.30/#example-332 + +` a` +| <- markup.raw.inline.markdown punctuation.definition.raw.begin.markdown +|^^^ markup.raw.inline.markdown +| ^ punctuation.definition.raw.end.markdown + +## https://spec.commonmark.org/0.30/#example-333 + +` b ` +| <- markup.raw.inline.markdown punctuation.definition.raw.begin.markdown +|^^^^ markup.raw.inline.markdown +| ^ punctuation.definition.raw.end.markdown + +## https://spec.commonmark.org/0.30/#example-334 + +` ` +| <- markup.raw.inline.markdown punctuation.definition.raw.begin.markdown +|^^ markup.raw.inline.markdown +| ^ punctuation.definition.raw.end.markdown +| ^ - markup + +` ` +| <- markup.raw.inline.markdown punctuation.definition.raw.begin.markdown +|^^^ markup.raw.inline.markdown +| ^ punctuation.definition.raw.end.markdown +| ^ - markup + +## https://spec.commonmark.org/0.30/#example-335 + +`` +foo +bar +baz +`` +| <- markup.raw.inline.markdown punctuation.definition.raw.end.markdown +|^ markup.raw.inline.markdown punctuation.definition.raw.end.markdown + +## https://spec.commonmark.org/0.30/#example-336 + +`` +foo +`` +| <- markup.raw.inline.markdown punctuation.definition.raw.end.markdown +|^ markup.raw.inline.markdown punctuation.definition.raw.end.markdown + +## https://spec.commonmark.org/0.30/#example-337 + +`foo bar + baz` +|^^^^^ markup.raw.inline.markdown +| ^ punctuation.definition.raw.end.markdown + +## https://spec.commonmark.org/0.30/#example-338 + +`foo\`bar` +| <- markup.raw.inline.markdown punctuation.definition.raw.begin.markdown +|^^^^^ markup.raw.inline.markdown +| ^^^ - markup.raw + +## https://spec.commonmark.org/0.30/#example-339 + +``foo`bar`` +| <- meta.paragraph.markdown markup.raw.inline.markdown punctuation.definition.raw.begin.markdown +|^^^^^^^^^^ meta.paragraph.markdown markup.raw.inline.markdown +|^ punctuation.definition.raw.begin.markdown +| ^^^^^^^ - punctuation +| ^^ punctuation.definition.raw.end.markdown + +````bar```` baz +|^^^^^^^^^^ markup.raw.inline.markdown +| ^^^^^ - markup.raw + +## https://spec.commonmark.org/0.30/#example-340 + +`foo `` bar` +| <- markup.raw.inline.markdown punctuation.definition.raw.begin.markdown +|^^^^^^^^^^ markup.raw.inline.markdown - punctuation +| ^ markup.raw.inline.markdown punctuation.definition.raw.end.markdown + +## https://spec.commonmark.org/0.30/#example-341 + +*foo`*` +| <- markup.italic.markdown punctuation.definition.italic.begin.markdown +| ^^^ markup.italic.markdown markup.raw.inline.markdown + +| <- invalid.illegal.non-terminated.bold-italic + +## https://spec.commonmark.org/0.30/#example-342 + +[not a `link](/foo`) +|^^^^^^^^^^^^^^^^^^^ - meta.link +| ^^^^^^^^^^^^ markup.raw.inline.markdown + +## https://spec.commonmark.org/0.30/#example-343 + +`` +|^^^^^^^^^^ markup.raw.inline.markdown +| ^^ - markup.raw + +| <- invalid.illegal.non-terminated.raw + +## https://spec.commonmark.org/0.30/#example-344 + +` +| ^^^^^^^^^ meta.tag.inline.a +| ^ punctuation.definition.raw.begin + +| <- invalid.illegal.non-terminated.raw + +## https://spec.commonmark.org/0.30/#example-345 + +`` +|^^^^^^^^^^^^^^^^^ markup.raw.inline +| ^ punctuation.definition.raw.begin + +| <- invalid.illegal.non-terminated.raw + +## https://spec.commonmark.org/0.30/#example-346 + +` +|^^^^^^^^^^^^^^^^^^^ markup.underline.link +| ^ punctuation.definition.raw.begin + +| <- invalid.illegal.non-terminated.raw + + +# TEST: EMPHASIS ############################################################## + +## https://spec.commonmark.org/0.30/#example-350 + +*foo bar* +| <- markup.italic.markdown punctuation.definition.italic.begin.markdown +|^^^^^^^^ markup.italic.markdown +| ^ punctuation.definition.italic.end + +## https://spec.commonmark.org/0.30/#example-351 + +This is not emphasis, because the opening `*` is followed by whitespace, and hence not part of a left-flanking delimiter run: + +a * foo bar* +| ^^^^^^^^^^^ - markup.italic - punctuation + +## https://spec.commonmark.org/0.30/#example-352 + +a*"foo"* +| <- - markup.italic - punctuation +|^^^^^^^ - markup.italic - punctuation + +## https://spec.commonmark.org/0.30/#example-353 + +* a * +| <- markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown - markup.italic +|^^^^^ markup.list.unnumbered.markdown - markup.italic - punctuation + +## https://spec.commonmark.org/0.30/#example-354 + +Intraword emphasis with `*` is permitted: + +foo*bar* +| <- - markup.italic +|^^ - markup.italic +| ^^^^^ markup.italic.markdown +| ^ punctuation.definition.italic.begin.markdown +| ^ punctuation.definition.italic.end.markdown + +## https://spec.commonmark.org/0.30/#example-355 + +5*6*78 +| <- - markup.italic +|^^^ markup.italic.markdown +|^ punctuation.definition.italic.begin.markdown +| ^ punctuation.definition.italic.end.markdown +| ^^ - markup.italic + +## https://spec.commonmark.org/0.30/#example-356 + +_foo bar_ +| <- markup.italic.markdown punctuation.definition.italic.begin.markdown +|^^^^^^^^ meta.paragraph.markdown markup.italic.markdown +| ^ punctuation.definition.italic.end.markdown + +## https://spec.commonmark.org/0.30/#example-357 + +This is not emphasis, because the opening `_` is followed by whitespace: + +_ foo bar_ +| <- - markup.italic - punctuation +|^^^^^^^^^ - markup.italic - punctuation + +## https://spec.commonmark.org/0.30/#example-358 + +This is not emphasis, because the opening `_` is preceded by an alphanumeric and followed by punctuation: + +a_"foo"_ +| <- - markup.italic - punctuation +|^^^^^^^ - markup.italic - punctuation + +## https://spec.commonmark.org/0.30/#example-359 + +Emphasis with `_` is not allowed inside words: + +foo_bar_ +| <- - markup.italic - punctuation +|^^^^^^^ - markup.italic - punctuation + +## https://spec.commonmark.org/0.30/#example-360 + +5_6_78 +| <- - markup.italic - punctuation +|^^^^^ - markup.italic - punctuation + +## https://spec.commonmark.org/0.30/#example-361 + +пристаням_стремятся_ +| <- - markup.italic - punctuation +|^^^^^^^^^^^^^^^^^^^ - markup.italic - punctuation + +## https://spec.commonmark.org/0.30/#example-362 + +Here `_` does not generate emphasis, because the first delimiter run is right-flanking +and the second left-flanking: + +aa_"bb"_cc +| <- - markup.italic - punctuation +|^^^^^^ - markup.italic - punctuation + +> Note: Needs ST4's branching to get it right! + +## https://spec.commonmark.org/0.30/#example-363 + +This is emphasis, even though the opening delimiter is both left- and right-flanking, +because it is preceded by punctuation: + +foo-_(bar)_ +| <- - markup.italic - punctuation +|^^^ - markup.italic - punctuation +| ^^^^^^^ markup.italic.markdown +| ^ punctuation.definition.italic.begin.markdown +| ^ punctuation.definition.italic.end.markdown + +## https://spec.commonmark.org/0.30/#example-365 + +This is not emphasis, because the closing `*` is preceded by whitespace: + +*foo bar * +| <- markup.italic.markdown punctuation.definition.italic.begin.markdown +|^^^^^^^^^^ markup.italic.markdown + +| <- markup.italic.markdown invalid.illegal.non-terminated.bold-italic.markdown + +> Note: Needs ST4's branching to get it right! + +## https://spec.commonmark.org/0.30/#example-366 + +A line ending also counts as whitespace: + +*foo bar * +| <- markup.italic.markdown punctuation.definition.italic.begin.markdown +|^^^^^^^^^^ markup.italic.markdown +| ^ - punctuation +* +| <- markup.italic.markdown - punctuation +abc* +| <- markup.italic.markdown +|^^^ meta.paragraph.markdown markup.italic.markdown +| ^ punctuation.definition.italic.end.markdown +| ^ - markup.italic + +## https://spec.commonmark.org/0.30/#example-367 + +This is not emphasis, because the second `*` is preceded by punctuation and followed +by an alphanumeric (hence it is not part of a right-flanking delimiter run): + +*(*foo) + +> Note: Needs ST4's branching to get it right! + +## https://spec.commonmark.org/0.30/#example-368 + +The point of this restriction is more easily appreciated with this example: + +*(*foo*)* + +> Note: Needs ST4's branching to get it right! + +## https://spec.commonmark.org/0.30/#example-369 + +Intraword emphasis with `*` is allowed: + +*foo*bar +| <- markup.italic.markdown punctuation.definition.italic.begin.markdown +|^^^^ markup.italic.markdown +| ^ punctuation.definition.italic.end.markdown +| ^^^^ - markup.italic + +## https://spec.commonmark.org/0.30/#example-370 + +This is not emphasis, because the closing `_` is preceded by whitespace: + +_foo bar _ +| <- markup.italic.markdown punctuation.definition.italic.begin.markdown +|^^^^^^^^^^ markup.italic.markdown +| ^ - punctuation + +| <- markup.italic.markdown invalid.illegal.non-terminated.bold-italic.markdown + +> Note: Needs ST4's branching to get it right! + +_foo bar _ +| <- markup.italic.markdown punctuation.definition.italic.begin.markdown +|^^^^^^^^^^ markup.italic.markdown +| ^ - punctuation +_ +| <- markup.italic.markdown - punctuation +abc_ +| <- markup.italic.markdown +|^^^ markup.italic.markdown +| ^ punctuation.definition.italic.end +| ^ - markup.italic + +## https://spec.commonmark.org/0.30/#example-371 + +This is not emphasis, because the second `_` is preceded by punctuation and followed +by an alphanumeric (hence it is not part of a right-flanking delimiter run): + +_(_foo) + +> Note: Needs ST4's branching to get it right! + +## https://spec.commonmark.org/0.30/#example-371 + +The point of this restriction is more easily appreciated with this example: + +_(_foo_)_ + +> Note: Needs ST4's branching to get it right! + +## https://spec.commonmark.org/0.30/#example-373 + +Intraword emphasis is disallowed for `_`: + +_foo_bar +| <- markup.italic.markdown punctuation.definition.italic.begin.markdown +|^^^^^^^^ markup.italic.markdown +| ^ - punctuation +abc_ +| <- markup.italic.markdown +|^^^ markup.italic.markdown +| ^ punctuation.definition.italic.end.markdown +| ^ - markup.italic + +> Note: Needs ST4's branching to get it right! + +## https://spec.commonmark.org/0.30/#example-374 + +Intraword emphasis is disallowed for `_`: + +_пристаням_стремятся +| <- markup.italic.markdown punctuation.definition.italic.begin.markdown +|^^^^^^^^^^^^^^^^^^^^ markup.italic.markdown + +| <- markup.italic.markdown invalid.illegal.non-terminated.bold-italic.markdown + +> Note: Needs ST4's branching to get it right! + +## https://spec.commonmark.org/0.30/#example-375 + +_foo_bar_baz_ +| <- markup.italic.markdown punctuation.definition.italic.begin.markdown +|^^^^^^^^^^^^ markup.italic.markdown +| ^^^^^ - punctuation +| ^ punctuation.definition.italic.end.markdown + +## https://spec.commonmark.org/0.30/#example-376 + +This is emphasis, even though the closing delimiter is both left- and right-flanking, +because it is followed by punctuation: + +_(bar)_. +| <- markup.italic.markdown punctuation.definition.italic.begin.markdown +|^^^^^^ markup.italic.markdown +| ^ punctuation.definition.italic.end.markdown +| ^^ - markup.italic + +## https://spec.commonmark.org/0.30/#example-377 + +**foo bar** +| <- markup.bold.markdown punctuation.definition.bold.begin.markdown +|^^^^^^^^^^ markup.bold.markdown +|^ punctuation.definition.bold.begin.markdown +| ^^ punctuation.definition.bold.end.markdown + +## https://spec.commonmark.org/0.30/#example-378 + +** foo bar** +| <- - markup - punctuation +|^^^^^^^^^^^ - markup - punctuation + +## https://spec.commonmark.org/0.30/#example-379 + +This is not strong emphasis, because the opening `**` is preceded by an alphanumeric +and followed by punctuation, and hence not part of a left-flanking delimiter run: + +a**"foo"** +| <- - markup - punctuation +|^^^^^^^^^ - markup - punctuation + +## https://spec.commonmark.org/0.30/#example-380 + +Intraword strong emphasis with `**` is permitted: + +foo**bar** +| <- - markup +|^^ - markup +| ^^^^^^^ meta.paragraph.markdown markup.bold.markdown +| ^^ punctuation.definition.bold.begin.markdown +| ^^ punctuation.definition.bold.end.markdown +| ^ - markup + +## https://spec.commonmark.org/0.30/#example-381 + +__foo bar__ +| <- markup.bold.markdown punctuation.definition.bold.begin.markdown +|^^^^^^^^^^ markup.bold.markdown +|^ punctuation.definition.bold.begin.markdown +| ^^ punctuation.definition.bold.end.markdown + +## https://spec.commonmark.org/0.30/#example-382 + +This is not strong emphasis, because the opening delimiter is followed by whitespace: +__ foo bar__ +| <- - markup - punctuation +|^^^^^^^^^^^ - markup - punctuation + +## https://spec.commonmark.org/0.30/#example-383 + +__ +| <- - punctuation +|^ - punctuation + +## https://spec.commonmark.org/0.30/#example-384 + +a__"foo"__ +| <- - markup - punctuation +|^^^^^^^^^ - markup - punctuation + +## https://spec.commonmark.org/0.30/#example-385 + +Intraword strong emphasis is forbidden with `__`: +foo__bar__ +| <- - markup - punctuation +|^^^^^^^^^ - markup - punctuation + +## https://spec.commonmark.org/0.30/#example-386 + +5__6__78 +| <- - markup - punctuation +|^^^^^^^ - markup - punctuation + +## https://spec.commonmark.org/0.30/#example-387 + +пристаням__стремятся__ +| <- - markup - punctuation +|^^^^^^^^^^^^^^^^^^^^^ - markup - punctuation + +## https://spec.commonmark.org/0.30/#example-389 + +foo-__(bar)__ +| <- - markup +|^^^ - markup +| ^^^^^^^^^ markup.bold.markdown +| ^^ punctuation.definition.bold.begin.markdown +| ^^ punctuation.definition.bold.end.markdown +| ^ - markup + +## https://spec.commonmark.org/0.30/#example-390 + +**foo bar ** +| <- markup.bold.markdown punctuation.definition.bold.begin.markdown +|^^^^^^^^^^^^ markup.bold.markdown +|^ punctuation.definition.bold.begin.markdown +| ^^ - punctuation + +| <- markup.bold.markdown invalid.illegal.non-terminated.bold-italic.markdown + +> Note: Needs ST4's branching to get it right! + +## https://spec.commonmark.org/0.30/#example-394 + +**foo "*bar*" foo** +| <- markup.bold.markdown punctuation.definition.bold.begin.markdown +|^^^^^^ markup.bold.markdown - markup.italic +|^ punctuation.definition.bold.begin.markdown +| ^^^^^ markup.bold.markdown markup.italic.markdown +| ^ punctuation.definition.italic.begin.markdown +| ^ punctuation.definition.italic.end.markdown +| ^^^^^^^ markup.bold.markdown - markup.italic +| ^^ punctuation.definition.bold.end.markdown +| ^ - markup + +## https://spec.commonmark.org/0.30/#example-395 + +Intraword emphasis: + +**foo**bar +| <- markup.bold.markdown punctuation.definition.bold.begin.markdown +|^^^^^^ markup.bold.markdown +| ^^ punctuation.definition.bold.end.markdown +| ^^^^ - markup + +## https://spec.commonmark.org/0.30/#example-396 + +__foo bar __ +| <- markup.bold.markdown punctuation.definition.bold.begin.markdown +|^^^^^^^^^^^^ markup.bold.markdown +|^ punctuation.definition.bold.begin.markdown +| ^^ - punctuation + +| <- markup.bold.markdown invalid.illegal.non-terminated.bold-italic.markdown + +> Note: Needs ST4's branching to get it right! + +## https://spec.commonmark.org/0.30/#example-397 + +This is not strong emphasis, because the second `__` +is preceded by punctuation and followed by an alphanumeric: + +__(__foo) + +> Note: Needs ST4's branching to get it right! + +## https://spec.commonmark.org/0.30/#example-398 + +_(__foo__)_ +| <- markup.italic.markdown punctuation.definition.italic.begin.markdown +| ^^^^^^^ markup.italic.markdown markup.bold.markdown +| ^^ punctuation.definition.bold.begin.markdown +| ^^ punctuation.definition.bold.end.markdown +| ^ punctuation.definition.italic.end.markdown + +## https://spec.commonmark.org/0.30/#example-399 + +Intraword strong emphasis is forbidden with `__`: +__foo__bar +| <- markup.bold.markdown punctuation.definition.bold.begin.markdown +|^^^^^^^^^^ markup.bold.markdown +|^ punctuation.definition.bold.begin.markdown +| ^^ - punctuation + +| <- markup.bold.markdown invalid.illegal.non-terminated.bold-italic.markdown + +> Note: Needs ST4's branching to get it right! + +## https://spec.commonmark.org/0.30/#example-400 + +__пристаням__стремятся +| <- markup.bold.markdown punctuation.definition.bold.begin.markdown +|^^^^^^^^^^^^^^^^^^^^^^ markup.bold.markdown +|^ punctuation.definition.bold.begin.markdown +| ^^ - punctuation + +| <- markup.bold.markdown invalid.illegal.non-terminated.bold-italic.markdown + +> Note: Needs ST4's branching to get it right! + +## https://spec.commonmark.org/0.30/#example-401 + +__foo__bar__baz__ +| <- markup.bold.markdown punctuation.definition.bold.begin.markdown +|^^^^^^^^^^^^^^^^ markup.bold.markdown +|^ punctuation.definition.bold.begin.markdown +| ^^^^^^^ - punctuation +| ^^ punctuation.definition.bold.end.markdown + +## https://spec.commonmark.org/0.30/#example-402 + +This is strong emphasis, even though the closing delimiter is both left- and right-flanking, +because it is followed by punctuation: + +__(bar)__. +| <- markup.bold.markdown punctuation.definition.bold.begin.markdown +|^^^^^^^^ markup.bold.markdown +|^ punctuation.definition.bold.begin.markdown +| ^^ punctuation.definition.bold.end.markdown +| ^^ - markup + +## https://spec.commonmark.org/0.30/#example-403 + +Any nonempty sequence of inline elements can be the contents of an emphasized span. + +*foo [bar](/url)* +| <- markup.italic.markdown punctuation.definition.italic.begin.markdown +|^^^^^^^^^^^^^^^^ markup.italic.markdown +| ^^^^^^^^^^^ meta.link.inline +| ^ punctuation.definition.italic.end.markdown + +## https://spec.commonmark.org/0.30/#example-404 + +*foo +| <- markup.italic.markdown punctuation.definition.italic.begin.markdown +|^^^^ markup.italic.markdown +bar* +| <- markup.italic.markdown +|^^^ markup.italic.markdown +| ^ punctuation.definition.italic.end +| ^ - markup + +## https://spec.commonmark.org/0.30/#example-405 + +_foo __bar__ baz_ +| <- markup.italic.markdown punctuation.definition.italic.begin.markdown +|^^^^ markup.italic.markdown - markup markup +| ^^ punctuation.definition.bold.begin.markdown +| ^^^^^^^ markup.italic.markdown markup.bold.markdown +| ^^ punctuation.definition.bold.end.markdown +| ^^^^^ markup.italic.markdown - markup markup +| ^ punctuation.definition.italic.end.markdown +| ^ - markup + +## https://spec.commonmark.org/0.30/#example-418 + +*foo [*bar*](/url)* +| <- markup.italic.markdown punctuation.definition.italic.begin.markdown +|^^^^^ markup.italic.markdown - markup.italic markup.italic +| ^^^^^^^^^^^^^ meta.link.inline +| ^^^^^ markup.italic.markdown markup.italic.markdown +| ^^^^^^^ markup.italic.markdown - markup.italic markup.italic + +*foo [_bar_](/url)* +| <- markup.italic.markdown punctuation.definition.italic.begin.markdown +|^^^^^ markup.italic.markdown - markup.italic markup.italic +| ^^^^^^^^^^^^^ meta.link.inline +| ^^^^^ markup.italic.markdown markup.italic.markdown +| ^^^^^^^ markup.italic.markdown - markup.italic markup.italic + +_foo [_bar_](/url)_ +| <- markup.italic.markdown punctuation.definition.italic.begin.markdown +|^^^^^ markup.italic.markdown - markup.italic markup.italic +| ^^^^^^^^^^^^^ meta.link.inline +| ^^^^^ markup.italic.markdown markup.italic.markdown +| ^^^^^^^ markup.italic.markdown - markup.italic markup.italic + +_foo [**bar**](/url)_ +| <- markup.italic.markdown punctuation.definition.italic.begin.markdown +|^^^^^ markup.italic.markdown - markup.italic markup.bold +| ^^^^^^^^^^^^^^^ meta.link.inline +| ^^ punctuation.definition.bold.begin.markdown +| ^^^^^^^ markup.italic.markdown markup.bold.markdown +| ^^ punctuation.definition.bold.end.markdown +| ^^^^^^^^ markup.italic.markdown - markup.italic markup.bold +| ^ punctuation.definition.italic.end.markdown + +_foo [__bar__](/url)_ +| <- markup.italic.markdown punctuation.definition.italic.begin.markdown +|^^^^^ markup.italic.markdown - markup.italic markup.bold +| ^^^^^^^^^^^^^^^ meta.link.inline +| ^^ punctuation.definition.bold.begin.markdown +| ^^^^^^^ markup.italic.markdown markup.bold.markdown +| ^^ punctuation.definition.bold.end.markdown +| ^^^^^^^^ markup.italic.markdown - markup.italic markup.bold +| ^ punctuation.definition.italic.end.markdown + +## https://spec.commonmark.org/0.30/#example-419 + +** is not an empty emphasis +| <- - punctuation +|^ - punctuation + +## https://spec.commonmark.org/0.30/#example-420 + +**** is not an empty strong emphasis +| <- - punctuation +|^^^ - punctuation + +## https://spec.commonmark.org/0.30/#example-421 + +**foo [bar](/url)** +| <- markup.bold.markdown punctuation.definition.bold.begin.markdown +|^^^^^^^^^^^^^^^^^^ markup.bold.markdown +|^ punctuation.definition.bold.begin.markdown +| ^^^^^^^^^^^ meta.link.inline +| ^^ punctuation.definition.bold.end.markdown + +## https://spec.commonmark.org/0.30/#example-422 + +**foo +| <- markup.bold.markdown punctuation.definition.bold.begin.markdown +|^^^^^ markup.bold.markdown +|^ punctuation.definition.bold.begin.markdown +bar** +| <- markup.bold.markdown +|^^^^ markup.bold.markdown +| ^^ punctuation.definition.bold.end +| ^ - markup + +## https://spec.commonmark.org/0.30/#example-423 + +__foo _bar_ baz__ +| <- markup.bold.markdown punctuation.definition.bold.begin.markdown +|^^^^^ markup.bold.markdown - markup markup +|^ punctuation.definition.bold.begin.markdown +| ^ punctuation.definition.italic.begin.markdown +| ^^^^^ markup.bold.markdown markup.italic.markdown +| ^ punctuation.definition.italic.end.markdown +| ^^^^^^ markup.bold.markdown - markup markup +| ^ punctuation.definition.bold.end.markdown +| ^ - markup + +## https://spec.commonmark.org/0.30/#example-432 + +**foo [*bar*](/url)** +| <- markup.bold.markdown punctuation.definition.bold.begin.markdown +|^^^^^^ markup.bold.markdown - markup.bold markup.italic +| ^^^^^^^^^^^^^ meta.link.inline +|^ punctuation.definition.bold.begin.markdown +| ^ punctuation.definition.italic.begin.markdown +| ^^^^^ markup.bold.markdown markup.italic.markdown +| ^ punctuation.definition.italic.end.markdown +| ^^^^^^^^^ markup.bold.markdown - markup.bold markup.italic +| ^^ punctuation.definition.bold.end.markdown + +**foo [_bar_](/url)** +| <- markup.bold.markdown punctuation.definition.bold.begin.markdown +|^^^^^^ markup.bold.markdown - markup.bold markup.italic +| ^^^^^^^^^^^^^ meta.link.inline +|^ punctuation.definition.bold.begin.markdown +| ^ punctuation.definition.italic.begin.markdown +| ^^^^^ markup.bold.markdown markup.italic.markdown +| ^ punctuation.definition.italic.end.markdown +| ^^^^^^^^^ markup.bold.markdown - markup.bold markup.italic +| ^^ punctuation.definition.bold.end.markdown + +## https://spec.commonmark.org/0.30/#example-433 + +__ is not an empty emphasis +| <- - markup - punctuation +|^^^^^^^^^^^^^^^^^^^^^^^^^^ - markup - punctuation + +## https://spec.commonmark.org/0.30/#example-434 + +____ is not an empty strong emphasis +| <- - markup - punctuation +|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - markup - punctuation + +## https://spec.commonmark.org/0.30/#example-435 + +foo *** +| ^^^ - markup - punctuation + +## https://spec.commonmark.org/0.30/#example-436 + +foo *\** +|^^^ - markup +| ^^^^ markup.italic.markdown +| ^ punctuation.definition.italic.begin.markdown +| ^^ constant.character.escape.markdown +| ^ punctuation.definition.italic.end.markdown +| ^ - markup + +## https://spec.commonmark.org/0.30/#example-437 + +foo *_* +|^^^ - markup +| ^^^ markup.italic.markdown +| ^punctuation.definition.italic.begin.markdown +| ^ punctuation.definition.italic.end.markdown +| ^ - markup + +## https://spec.commonmark.org/0.30/#example-439 + +foo **\*** +|^^^ - markup +| ^^^^^^ markup.bold.markdown +| ^^ punctuation.definition.bold.begin.markdown +| ^^ constant.character.escape.markdown +| ^^ punctuation.definition.bold.end.markdown +| ^ - markup + +## https://spec.commonmark.org/0.30/#example-440 + +foo **_** +|^^^ - markup +| ^^^^^ markup.bold.markdown +| ^^punctuation.definition.bold.begin.markdown +| ^^ punctuation.definition.bold.end.markdown +| ^ - markup + +## https://spec.commonmark.org/0.30/#example-441 + +**foo* + +> Note: Needs ST4's branching to get it right! + +## https://spec.commonmark.org/0.30/#example-442 + +*foo** + +> Note: Needs ST4's branching to get it right! + +## https://spec.commonmark.org/0.30/#example-443 + +***foo** + +> Note: Needs ST4's branching to get it right! + +## https://spec.commonmark.org/0.30/#example-444 + +****foo* + +> Note: Needs ST4's branching to get it right! + +## https://spec.commonmark.org/0.30/#example-445 + +**foo*** +| <- markup.bold.markdown punctuation.definition.bold.begin.markdown +|^^^^^^ markup.bold.markdown +|^ punctuation.definition.bold.begin.markdown +| ^^ punctuation.definition.bold.end.markdown +| ^^ - markup - punctuation + +## https://spec.commonmark.org/0.30/#example-446 + +*foo**** + +> Note: Needs ST4's branching to get it right! + +## https://spec.commonmark.org/0.30/#example-447 + +foo ___ +| ^^^ - markup - punctuation + +## https://spec.commonmark.org/0.30/#example-448 + +foo _\__ +|^^^ - markup +| ^^^^ markup.italic.markdown +| ^ punctuation.definition.italic.begin.markdown +| ^^ constant.character.escape.markdown +| ^ punctuation.definition.italic.end.markdown +| ^ - markup + +## https://spec.commonmark.org/0.30/#example-449 + +foo _*_ +|^^^ - markup +| ^^^ markup.italic.markdown +| ^punctuation.definition.italic.begin.markdown +| ^ punctuation.definition.italic.end.markdown +| ^ - markup + +## https://spec.commonmark.org/0.30/#example-450 + +foo _____ +| ^^^^^ - markup - punctuation + +## https://spec.commonmark.org/0.30/#example-451 + +foo __\___ +|^^^ - markup +| ^^^^^^ markup.bold.markdown +| ^^ punctuation.definition.bold.begin.markdown +| ^^ constant.character.escape.markdown +| ^^ punctuation.definition.bold.end.markdown +| ^ - markup + +## https://spec.commonmark.org/0.30/#example-452 + +foo __*__ +|^^^ - markup +| ^^^^^ markup.bold.markdown +| ^^punctuation.definition.bold.begin.markdown +| ^^ punctuation.definition.bold.end.markdown +| ^ - markup + +## https://custom-tests/emphasis + +This text is _italic_, but this__text__is neither bold_nor_italic +| ^ punctuation.definition.italic +| ^^^^^^ markup.italic +| ^ punctuation.definition.italic +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - markup.bold - markup.italic + +the following is italic *and doesn't end here * but does end here* +| ^ punctuation.definition.italic.begin +| ^ - punctuation.definition.italic +| ^ punctuation.definition.italic.end + +the following is bold **and doesn't end here ** but does end here** +| ^^ punctuation.definition.bold.begin +| ^^ - punctuation.definition.bold +| ^^ punctuation.definition.bold.end + +the following is not bold ** test **** +| ^^ - punctuation.definition.bold.begin +| ^^^^ - punctuation.definition.bold + +the following is not italic _ test ____ +| ^ - punctuation.definition.italic.begin +| ^^^^ - punctuation.definition.italic + +more **tests *** ** here** +| ^^ punctuation.definition.bold.begin +| ^^^^^^ - punctuation.definition +| ^^ punctuation.definition.bold.end + +more __tests *** ** example __ here__ +| ^^ punctuation.definition.bold.begin +| ^^^^^^^^^^^^^^^^^^^^^^ - punctuation.definition +| ^^ punctuation.definition.bold.end + +more _tests here_ +| ^ punctuation.definition.italic.begin +| ^ - punctuation.definition +| ^ punctuation.definition.italic.end + +more _tests _here_ +| ^ punctuation.definition.italic.begin +| ^ - punctuation.definition +| ^ - punctuation +| ^ punctuation.definition.italic.end + +_more `tests_` here_ +| <- punctuation.definition.italic.begin +| ^^^^^^^^ markup.raw.inline +| ^ punctuation.definition.italic.end + +__more `tests__` here__ +| <- punctuation.definition.bold.begin +| ^^^^^^^^^ markup.raw.inline +| ^^ punctuation.definition.bold.end + +**more `tests__` here** +| <- punctuation.definition.bold.begin +| ^^^^^^^^^ markup.raw.inline +| ^^ punctuation.definition.bold.end + +**more `tests**` here** +| <- punctuation.definition.bold.begin +| ^^^^^^^^^ markup.raw.inline +| ^^ punctuation.definition.bold.end + +*more `tests__` here** +| <- punctuation.definition.italic.begin +| ^^ - punctuation +abc* +| ^ punctuation.definition.italic.end + +This is ***bold italic*** +| ^^^^^^^^^^^^^^^^^ markup.bold +| ^^ punctuation.definition.bold.begin +| ^ punctuation.definition.italic.begin +| ^^^^^^^^^^^^^ markup.italic +| ^ punctuation.definition.italic.end +| ^^ punctuation.definition.bold.end + +This is ***bold italic* and just bold** +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.bold +| ^^ punctuation.definition.bold.begin +| ^ punctuation.definition.italic.begin +| ^^^^^^^^^^^^^ markup.italic +| ^ punctuation.definition.italic.end +| ^^^^^^^^^^^^^^^^ - markup.italic +| ^^ punctuation.definition.bold.end + +The next scope overlap funny because we have to pick one order +to scope three indicators in a row +This is ***bold italic** and just italic* +| ^^^^^^^^^^^^^^^^ markup.bold +| ^^ punctuation.definition.bold.begin +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.italic +| ^ punctuation.definition.italic.begin +| ^^ punctuation.definition.bold.end +| ^^^^^^^^^^^^^^^^^ - markup.bold +| ^ punctuation.definition.italic.end + +This is **_bold italic_** +| ^^^^^^^^^^^^^^^^^ markup.bold +| ^^ punctuation.definition.bold.begin +| ^ punctuation.definition.italic.begin +| ^^^^^^^^^^^^^ markup.italic +| ^ punctuation.definition.italic.end +| ^^ punctuation.definition.bold.end + +This is __*bold italic*__ +| ^^^^^^^^^^^^^^^^^ markup.bold +| ^^ punctuation.definition.bold.begin +| ^ punctuation.definition.italic.begin +| ^^^^^^^^^^^^^ markup.italic +| ^ punctuation.definition.italic.end +| ^^ punctuation.definition.bold.end + +This is ___bold italic___ +| ^^^^^^^^^^^^^^^^^ markup.bold +| ^^ punctuation.definition.bold.begin +| ^ punctuation.definition.italic.begin +| ^^^^^^^^^^^^^ markup.italic +| ^ punctuation.definition.italic.end +| ^^ punctuation.definition.bold.end + +This is ___bold italic_ and just bold__ +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.bold +| ^^ punctuation.definition.bold.begin +| ^ punctuation.definition.italic.begin +| ^^^^^^^^^^^^^ markup.italic +| ^ punctuation.definition.italic.end +| ^^^^^^^^^^^^^^^^ - markup.italic +| ^^ punctuation.definition.bold.end + +The next scope overlap funny because we have to pick one order +to scope three indicators in a row +This is ___bold italic__ and just italic_ +| ^^^^^^^^^^^^^^^ markup.bold +| ^^ punctuation.definition.bold.begin +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.italic +| ^ punctuation.definition.italic.begin +| ^^ punctuation.definition.bold.end +| ^^^^^^^^^^^^^^^^^ - markup.bold +| ^ punctuation.definition.italic.end + +This is _**italic bold**_ +| ^^^^^^^^^^^^^^^^^ markup.italic +| ^ punctuation.definition.italic.begin +| ^^^^^^^^^^^^^^^ markup.bold +| ^^ punctuation.definition.bold.begin +| ^^ punctuation.definition.bold.end +| ^ punctuation.definition.italic.end + +This is *__italic bold__* +| ^^^^^^^^^^^^^^^^^ markup.italic +| ^ punctuation.definition.italic.begin +| ^^^^^^^^^^^^^^^ markup.bold +| ^^ punctuation.definition.bold.begin +| ^^ punctuation.definition.bold.end +| ^ punctuation.definition.italic.end + +**test!_test** Issue 1163 +|^^^^^^^^^^^^^ markup.bold +| ^ - punctuation.definition.italic +| ^^ punctuation.definition.bold.end + +__test!*test__ Issue 1163 +|^^^^^^^^^^^^^ markup.bold +| ^ - punctuation.definition.italic +| ^^ punctuation.definition.bold.end + +*test + +| <- invalid.illegal.non-terminated.bold-italic +abc* +| ^ - punctuation + +_test + +| <- invalid.illegal.non-terminated.bold-italic +abc_ +| ^ - punctuation + +**test + +| <- invalid.illegal.non-terminated.bold-italic +abc** +| ^^ - punctuation + +__test + +| <- invalid.illegal.non-terminated.bold-italic +abc__ +| ^^ - punctuation + +__test\ +| ^ meta.hard-line-break constant.character.escape +testing__ + +*italic text HTML element end of italic text* +| <- punctuation.definition.italic +| ^ punctuation.definition.italic +| ^^^^^^ meta.tag.inline.any.html +| ^^^^^^^ meta.tag.inline.any.html + +_italic text HTML element end of italic text_ +| <- punctuation.definition.italic +| ^ punctuation.definition.italic +| ^^^^^^ meta.tag.inline.any.html +| ^^^^^^^ meta.tag.inline.any.html + +**bold text HTML element end of bold text** +| <- punctuation.definition.bold +| ^^ punctuation.definition.bold +| ^^^^^^ meta.tag.inline.any.html +| ^^^^^^^ meta.tag.inline.any.html + +__bold text HTML element end of bold text__ +| <- punctuation.definition.bold +| ^^ punctuation.definition.bold +| ^^^^^^ meta.tag.inline.any.html +| ^^^^^^^ meta.tag.inline.any.html + +*italic text HTML element end of italic text* +| <- punctuation.definition.italic +| ^ punctuation.definition.italic +| ^^^^^^ meta.tag.inline.any.html +| ^^^^^^^ meta.tag.inline.any.html + +_italic text HTML element end of italic text_ +| <- punctuation.definition.italic +| ^ punctuation.definition.italic +| ^^^^^^ meta.tag.inline.any.html +| ^^^^^^^ meta.tag.inline.any.html + +_test text_ foobar +| <- punctuation +| ^ punctuation.definition.italic.end + +__test text__ not formatted +| <- punctuation +| ^^ punctuation.definition.bold.end + +*test text* not formatted +| <- punctuation +| ^ punctuation.definition.italic.end + +**test text** not formatted +| <- punctuation +| ^^ punctuation.definition.bold.end + +_test text **formatted**_ +| <- punctuation +| ^^ punctuation +| ^^ punctuation +| ^ punctuation + +*test text __formatted__* +| <- punctuation +| ^^ punctuation +| ^^ punctuation +| ^ punctuation + +*test text __formatted__* **more** _text_ +| <- punctuation +| ^^ punctuation +| ^^ punctuation +| ^ punctuation +| ^^ punctuation +| ^^ punctuation +| ^ punctuation +| ^ punctuation + +*test text* __formatted__ +| <- punctuation +| ^ punctuation +| ^^ punctuation +| ^^ punctuation + +__test text__ *formatted* +| <- punctuation +| ^^ punctuation +| ^ punctuation +| ^ punctuation + +# TEST: STRIKETHROUGH ######################################################### + +__~~bold striked~~__ +| <- markup.bold.markdown punctuation.definition.bold.begin.markdown +|^ markup.bold.markdown - markup.strikethrough +| ^^^^^^^^^^^^^^^^ markup.bold.markdown markup.strikethrough.markdown-gfm +| ^^ markup.bold.markdown - markup.strikethrough +|^ punctuation.definition.bold.begin.markdown +| ^^ punctuation.definition.strikethrough.begin.markdown +| ^^ punctuation.definition.strikethrough.end.markdown +| ^^ punctuation.definition.bold.end.markdown + +**~~bold striked~~** +| <- markup.bold.markdown punctuation.definition.bold.begin.markdown +|^ markup.bold.markdown - markup.strikethrough +| ^^^^^^^^^^^^^^^^ markup.bold.markdown markup.strikethrough.markdown-gfm +| ^^ markup.bold.markdown - markup.strikethrough +|^ punctuation.definition.bold.begin.markdown +| ^^ punctuation.definition.strikethrough.begin.markdown +| ^^ punctuation.definition.strikethrough.end.markdown +| ^^ punctuation.definition.bold.end.markdown + +_~~italic striked~~_ +| <- markup.italic.markdown punctuation.definition.italic.begin.markdown +|^^^^^^^^^^^^^^^^^^ markup.italic.markdown markup.strikethrough.markdown-gfm +| ^ markup.italic.markdown - markup.strikethrough +|^^ punctuation.definition.strikethrough.begin.markdown +| ^^ punctuation.definition.strikethrough.end.markdown +| ^ punctuation.definition.italic.end.markdown + +*~~italic striked~~* +| <- markup.italic.markdown punctuation.definition.italic.begin.markdown +|^^^^^^^^^^^^^^^^^^ markup.italic.markdown markup.strikethrough.markdown-gfm +| ^ markup.italic.markdown - markup.strikethrough +|^^ punctuation.definition.strikethrough.begin.markdown +| ^^ punctuation.definition.strikethrough.end.markdown +| ^ punctuation.definition.italic.end.markdown + +___~~bold italic striked~~___ +| <- markup.bold.markdown punctuation.definition.bold.begin.markdown +|^ markup.bold.markdown - markup.italic - markup.strikethrough +| ^ markup.bold.markdown markup.italic.markdown - markup.strikethrough +| ^^^^^^^^^^^^^^^^^^^^^^^ markup.bold.markdown markup.italic.markdown markup.strikethrough.markdown-gfm +| ^ markup.bold.markdown markup.italic.markdown - markup.strikethrough +| ^^ markup.bold.markdown - markup.italic - markup.strikethrough +|^ punctuation.definition.bold.begin.markdown +| ^ punctuation.definition.italic.begin.markdown +| ^^ punctuation.definition.strikethrough.begin.markdown +| ^^ punctuation.definition.strikethrough.end.markdown +| ^ punctuation.definition.italic.end.markdown +| ^^ punctuation.definition.bold.end.markdown + +***~~bold italic striked~~*** +| <- markup.bold.markdown punctuation.definition.bold.begin.markdown +|^ markup.bold.markdown - markup.italic - markup.strikethrough +| ^ markup.bold.markdown markup.italic.markdown - markup.strikethrough +| ^^^^^^^^^^^^^^^^^^^^^^^ markup.bold.markdown markup.italic.markdown markup.strikethrough.markdown-gfm +| ^ markup.bold.markdown markup.italic.markdown - markup.strikethrough +| ^^ markup.bold.markdown - markup.italic - markup.strikethrough +|^ punctuation.definition.bold.begin.markdown +| ^ punctuation.definition.italic.begin.markdown +| ^^ punctuation.definition.strikethrough.begin.markdown +| ^^ punctuation.definition.strikethrough.end.markdown +| ^ punctuation.definition.italic.end.markdown +| ^^ punctuation.definition.bold.end.markdown + +~Hi~ Hello, world! +| <- - punctuation.definition.strikethrough +|^^^^^^^^^^^^^^^^^ meta.paragraph - markup +| ^ - punctuation.definition.strikethrough + +This ~text~~~~ is ~~~~curious~. +|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.paragraph - markup +| ^ - punctuation.definition.strikethrough +| ^^^^ - punctuation.definition.strikethrough +| ^^^^ - punctuation.definition.strikethrough +| ^ - punctuation.definition.strikethrough + +This ~~text~~~~ is ~~~~curious~~. +|^^^^ meta.paragraph - markup +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.paragraph markup.strikethrough +| ^^ meta.paragraph - markup +| ^^ punctuation.definition.strikethrough.begin +| ^^^^ - punctuation.definition.strikethrough +| ^^^^ - punctuation.definition.strikethrough +| ^^ punctuation.definition.strikethrough.end + +This ~~has a +| ^^^^^^^^ meta.paragraph markup.strikethrough + +| <- meta.paragraph markup.strikethrough invalid.illegal.non-terminated.bold-italic +new paragraph~~. +| ^^ meta.paragraph markup.strikethrough punctuation.definition.strikethrough.begin + +| <- invalid.illegal.non-terminated.bold-italic + +A ~~[striked](https://link-url)~~ +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.paragraph.markdown markup.strikethrough.markdown-gfm + +A ~~![striked](https://image-url)~~ +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.paragraph.markdown markup.strikethrough.markdown-gfm + +A ~~[![striked](image-url)](link-url)~~ +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.paragraph.markdown markup.strikethrough.markdown-gfm + + +# TEST: LINKS ################################################################# + +A [link](https://example.com){ :_attr = value }, *italic text* and **bold**. +| ^^^^^^ meta.link.inline.description.markdown +| ^ punctuation.definition.link.begin +| ^ punctuation.definition.link.end +| ^ punctuation.definition.metadata +| ^^^^^^^^^^^^^^^^^^^ markup.underline.link +| ^ punctuation.definition.metadata +| ^ punctuation.definition.attributes.begin.markdown +| ^^^^^^^^^^^^^^ meta.attribute-with-value.markdown +| ^^^^^^ entity.other.attribute-name.markdown +| ^ punctuation.separator.key-value.markdown +| ^^^^^ string.unquoted.markdown +| ^ punctuation.definition.attributes.end.markdown +| ^^^^^^^^^^^^^ markup.italic +| ^ punctuation.definition.italic +| ^ punctuation.definition.italic +| ^^ punctuation.definition.bold +| ^^^^^^^^ markup.bold +| ^^ punctuation.definition.bold + +Here is a [](https://example.com). +| ^^ meta.link.inline +| ^ punctuation.definition.link.begin +| ^ punctuation.definition.link.end +| ^ punctuation.definition.metadata +| ^^^^^^^^^^^^^^^^^^^ markup.underline.link +| ^ punctuation.definition.metadata + +Here is a [](https://example.com){_attr="value"}. +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.inline +| ^ punctuation.definition.link.begin +| ^ punctuation.definition.link.end +| ^ punctuation.definition.metadata +| ^^^^^^^^^^^^^^^^^^^ markup.underline.link +| ^ punctuation.definition.metadata +| ^ punctuation.definition.attributes.begin.markdown +| ^^^^^^^^^^^^^ meta.attribute-with-value.markdown +| ^^^^^ entity.other.attribute-name.markdown +| ^ punctuation.separator.key-value.markdown +| ^^^^^^^ string.quoted.double.markdown +| ^ punctuation.definition.attributes.end.markdown + +Here is a [link](#with_(parens/inside)_urls). +| ^^^^^^ meta.link.inline.description.markdown +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.inline.metadata.markdown +| ^^ - meta.link +| ^ punctuation.definition.metadata.begin.markdown +| ^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.markdown +| ^ punctuation.definition.metadata.end.markdown + +Here is a [link](\(foo\)). +| ^^^^^^ meta.link.inline.description.markdown +| ^^^^^^^^^ meta.link.inline.metadata.markdown +| ^^ - meta.link +| ^ punctuation.definition.metadata.begin.markdown +| ^^^^^^^ markup.underline.link.markdown +| ^^ constant.character.escape.markdown +| ^^ constant.character.escape.markdown +| ^ punctuation.definition.metadata.end.markdown + +Here is a [link](foo\)\:). +| ^^^^^^ meta.link.inline.description.markdown +| ^^^^^^^^^ meta.link.inline.metadata.markdown +| ^^ - meta.link +| ^ punctuation.definition.metadata.begin.markdown +| ^^^^^^^ markup.underline.link.markdown +| ^^ constant.character.escape.markdown +| ^ punctuation.definition.metadata.end.markdown + +Here is a [link](). +| ^^^^^^ meta.link.inline.description.markdown +| ^^^^^^^^^^^^^^^^ meta.link.inline.metadata.markdown +| ^^ - meta.link +| ^ punctuation.definition.metadata.begin.markdown +| ^ punctuation.definition.link.begin.markdown +| ^^^^^^^^^^^^ markup.underline.link.markdown +| ^ punctuation.definition.link.end.markdown +| ^ punctuation.definition.metadata.end.markdown + +Here is a [link](http://example.com?foo=3#frag). +| ^^^^^^ meta.link.inline.description.markdown +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.inline.metadata.markdown +| ^^ - meta.link +| ^ punctuation.definition.metadata.begin.markdown +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.markdown +| ^^^ punctuation.separator.path.markdown +| ^ punctuation.separator.path.markdown +| ^ punctuation.separator.path.markdown +| ^ punctuation.definition.metadata.end.markdown + +Not a [link] (url) due to space. +| ^^^^^^ meta.link.reference.description.markdown +| ^^^^^^^^^^^^^^^^^^^^^ - meta.link + +Here is a [reference link][name]. +| ^^^^^^^^^^^^^^^^ meta.link.reference.description.markdown +| ^^^^^^ meta.link.reference.metadata.markdown +| ^ punctuation.definition.link.begin.markdown +| ^ punctuation.definition.link.end.markdown +| ^ punctuation.definition.metadata.begin.markdown +| ^^^^ markup.underline.link.markdown +| ^ punctuation.definition.metadata.end.markdown + +Here is a [reference link][name]{_attr='value' :att2}. +| ^^^^^^^^^^^^^^^^ meta.link.reference.description.markdown +| ^^^^^^ meta.link.reference.metadata.markdown +| ^^^^^^^^^^^^^^^^^^^^^ meta.link.reference.attributes.markdown +| ^^^^^^^^^^^^^ meta.attribute-with-value.markdown +| ^ - meta.attribute-with-value +| ^^^^^ meta.attribute-with-value.markdown +| ^ punctuation.definition.link.begin.markdown +| ^ punctuation.definition.link.end.markdown +| ^ punctuation.definition.metadata.begin.markdown +| ^^^^ markup.underline.link.markdown +| ^ punctuation.definition.metadata.end.markdown +| ^ punctuation.definition.attributes.begin.markdown +| ^^^^^ entity.other.attribute-name.markdown +| ^ punctuation.separator.key-value.markdown +| ^^^^^^^ string.quoted.single.markdown +| ^^^^^ entity.other.attribute-name.markdown +| ^ punctuation.definition.attributes.end.markdown + +Here is a [blank reference link][]{}. +| ^^^^^^^^^^^^^^^^^^^^^^ meta.link.reference.literal.description.markdown +| ^^ meta.link.reference.literal.metadata.markdown +| ^^ meta.link.reference.literal.attributes.markdown +| ^ punctuation.definition.link.begin.markdown +| ^ punctuation.definition.link.end.markdown +| ^ punctuation.definition.metadata.begin.markdown +| ^ punctuation.definition.metadata.end.markdown +| ^ punctuation.definition.attributes.begin.markdown +| ^ punctuation.definition.attributes.end.markdown + +now you can access the [The Ever Cool Site: Documentation about Sites]( + www.thecoolsite.com.ca/documentations/about/cool ) for more information about... +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.inline markup.underline.link +| ^ - invalid +| ^ meta.link.inline punctuation.definition.metadata.end + +now you can access the [The Ever Cool Site: Documentation about Sites]( + www.thecoolsite.com.ca /documentations/about/cool ) for more information about... +| ^^^^^^^^^^^^^^^^^^^^^^ meta.paragraph meta.link.inline markup.underline.link +| ^ meta.paragraph meta.link.inline - markup.underline.link +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.paragraph - meta.link.inline + +now you can access the [The Ever Cool Site: Documentation about Sites]( + www.thecoolsite.com.ca/documentations/about/cool + (title)) for more information about... +| ^^^^^^^^ meta.paragraph meta.link.inline +| ^ punctuation.definition.metadata.end +| ^^^^^^^ string.quoted.other.markdown + +link with a single underscore inside the text : [@_test](http://example.com) +| ^^^^^^ meta.paragraph meta.link.inline.description - punctuation.definition +| ^ meta.paragraph meta.link.inline punctuation.definition.link.end + +[foo] +|<- meta.link.reference punctuation.definition.link.begin +|^^^ meta.paragraph meta.link.reference +| ^ meta.link.reference punctuation.definition.link.end + +This is literal [Foo*bar\]] but [ref][Foo*bar\]] +| ^^^^^^^^^^^ meta.link.reference.description.markdown +| ^ punctuation.definition.link.begin.markdown +| ^^^^^^^ - constant +| ^^ constant.character.escape.markdown +| ^ punctuation.definition.link.end.markdown +| ^^^^^ meta.link.reference.description.markdown +| ^^^^^^^^^^^ meta.link.reference.metadata.markdown + +[**Read more →**][details] +|^^^^^^^^^^^^^^^^^^^^^^ meta.link.reference.description.markdown +| ^^^^^^^^^ meta.link.reference.metadata.markdown +|^^ punctuation.definition.bold.begin.markdown +| ^^^^^^^ constant.character.entity.decimal.html +| ^^ punctuation.definition.bold.end.markdown +| ^^^^^^^ markup.underline.link.markdown + +[Read more →][details] +|^^^^^^^^^^^^^^^^^^ meta.link.reference.description.markdown +| ^^^^^^^^^ meta.link.reference.metadata.markdown +| ^^^^^^^ constant.character.entity.decimal.html +| ^^^^^^^ markup.underline.link + +[Read more ][details] +|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.reference.description.markdown +| ^^^^^^^^^ meta.link.reference.metadata.markdown +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag +| ^^^^^^^^^^^^^^^^^^ source.css +| ^^^^^^^ constant.character.entity.decimal.html - meta.tag +| ^^^^^^^ meta.tag +| ^^^^^^^ markup.underline.link + +[![Cool ★ Image - Click to Enlarge][img-example]][img-example] +| <- meta.link.reference.description.markdown punctuation.definition.link.begin.markdown +|^^ meta.link.reference.description.markdown meta.image.reference.description.markdown +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.reference.description.markdown meta.image.reference.description.markdown +| ^^^^^^^^^^^^^^ meta.link.reference.description.markdown +| ^^^^^^^^^^^^^ meta.link.reference.metadata.markdown +|^^ punctuation.definition.image.begin.markdown +| ^ punctuation.definition.image.end.markdown +| ^ punctuation.definition.metadata.begin.markdown +| ^^^^^^^^^^^ markup.underline.link +| ^ punctuation.definition.metadata.end.markdown +| ^ punctuation.definition.link.end.markdown +| ^ punctuation.definition.metadata.begin.markdown +| ^^^^^^^^^^^ markup.underline.link +| ^ punctuation.definition.metadata.end.markdown + +[![Cool ★ Image - Click to Enlarge](http://www.sublimetext.com/anim/rename2_packed.png)](http://www.sublimetext.com/anim/rename2_packed.png) +| <- meta.paragraph.markdown meta.link.inline.description.markdown punctuation.definition.link.begin.markdown +|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.paragraph.markdown meta.link.inline.description.markdown meta.image.inline.description.markdown +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.paragraph.markdown meta.link.inline.description.markdown meta.image.inline.metadata.markdown +| ^ meta.paragraph.markdown meta.link.inline.description.markdown +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.paragraph.markdown meta.link.inline.metadata.markdown +|^^ punctuation.definition.image.begin.markdown +| ^ punctuation.definition.image.end.markdown +| ^ punctuation.definition.metadata.begin.markdown +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.image.markdown +| ^ punctuation.definition.metadata.end.markdown +| ^ punctuation.definition.link.end.markdown +| ^ punctuation.definition.metadata.begin.markdown +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.markdown +| ^ punctuation.definition.metadata.end.markdown + +[link [containing] [square] brackets](#backticks) +|<- punctuation.definition.link.begin +|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.inline.description +| ^ punctuation.definition.link.end + +[link `containing square] brackets] in backticks`[]](#wow) +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.inline.description +| ^ punctuation.definition.raw.begin +| ^ punctuation.definition.raw.end +| ^ punctuation.definition.link.end + +[link ``containing square]` brackets[[][] in backticks``](#wow) +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.inline.description +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.raw.inline +| ^^ punctuation.definition.raw.begin +| ^^ punctuation.definition.raw.end +| ^ punctuation.definition.link.end + +This is a [reference] () +| ^^^^^^^^^^^ meta.link.reference +| ^^^^ - meta.link + +This is a [reference] (followed by parens) +| ^^^^^^^^^^^ meta.link.reference +| ^^^^^^^^^^^^^^^^^^^^^ - meta.link + +This is a [reference] [] +| ^^^^^^^^^^^ meta.link.reference +| ^ - meta.link +| ^^ meta.link.reference + +This is a ![reference] () +| ^^^^^^^^^^^^^^^ - meta.image +| ^^^^^^^^^^^ meta.link.reference +| ^^^^ - meta.link + +This is a ![reference] (followed by parens) +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.image +| ^^^^^^^^^^^ meta.link.reference +| ^^^^^^^^^^^^^^^^^^^^^ - meta.link + +This is a ![reference] [] +| ^^^^^^^^^^^^^^^ - meta.image +| ^^^^^^^^^^^ meta.link.reference +| ^ - meta.link +| ^^ meta.link.reference + + +# TEST: IMAGES ################################################################ + +Here is a ![](https://example.com/cat.gif). +| ^^^ meta.image.inline.description.markdown +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.image.inline.metadata.markdown +| ^^ - meta.image +| ^^ punctuation.definition.image.begin.markdown +| ^ punctuation.definition.image.end.markdown - string +| ^ punctuation.definition.metadata.begin.markdown +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.image.markdown +| ^ punctuation.definition.metadata.end.markdown + +Here is a ![](https://example.com/cat.gif){_at"r=value :att2}. +| ^^^ meta.image.inline.description.markdown +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.image.inline.metadata.markdown +| ^^^^^^^^^^^^^^^^^^^ meta.image.inline.attributes.markdown +| ^^ - meta.image +| ^^ punctuation.definition.image.begin.markdown +| ^ punctuation.definition.image.end.markdown - string +| ^ punctuation.definition.metadata.begin.markdown +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.image.markdown +| ^ punctuation.definition.metadata +| ^ punctuation.definition.attributes.begin.markdown +| ^^^^^ entity.other.attribute-name.markdown +| ^ invalid.illegal.attribute-name.markdown +| ^ punctuation.separator.key-value.markdown +| ^^^^^ string.unquoted.markdown +| ^^^^^ entity.other.attribute-name.markdown +| ^ punctuation.definition.attributes.end.markdown + +Here is a ![Image Alt Text](https://example.com/cat.gif). +| ^^^^^^^^^^^^^^^^^ meta.image.inline.description.markdown +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.image.inline.metadata.markdown +| ^^ - meta.image +| ^^ punctuation.definition.image.begin.markdown +| ^ punctuation.definition.image.end.markdown - string +| ^ punctuation.definition.metadata.begin.markdown +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.image.markdown +| ^ punctuation.definition.metadata.end.markdown + +Here is a ![Image Alt Text]( https://example.com/cat.gif ). +| ^^^^^^^^^^^^^^^^^ meta.image.inline.description.markdown +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.image.inline.metadata.markdown +| ^^ - meta.image +| ^^ punctuation.definition.image.begin.markdown +| ^ punctuation.definition.image.end - string +| ^ punctuation.definition.metadata.begin.markdown +| ^^ - markup.underline +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.image.markdown +| ^^ - markup.underline +| ^ punctuation.definition.metadata.end.markdown + +Here is a ![Image Alt Text]( + https://example.com/cat.gif ). +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.image.markdown +| ^ punctuation.definition.metadata.end.markdown + +Here is a ![Image Alt Text]( + https://example.com/cat.gif + "hello" ). +|^^^^^^^ meta.image.inline string.quoted.double +| ^^^^ meta.image.inline +| ^ punctuation.definition.metadata.end + +Here is a ![Image Alt Text]( + "hello" ). +|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.paragraph.markdown meta.image.inline.metadata.markdown +| ^^ meta.paragraph.markdown - meta.image +| ^ punctuation.definition.link.begin.markdown +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.image.markdown +| ^ punctuation.definition.link.end.markdown +| ^^^^^^^ string.quoted.double.markdown +| ^ punctuation.definition.string.begin.markdown +| ^ punctuation.definition.string.end.markdown +| ^ punctuation.definition.metadata.end.markdown + +Here is a ![Image Alt Text]( + (hello) ). +|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.paragraph.markdown meta.image.inline.metadata.markdown +| ^^ meta.paragraph.markdown - meta.image +| ^ punctuation.definition.link.begin.markdown +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.image.markdown +| ^ punctuation.definition.link.end.markdown +| ^^^^^^^ string.quoted.other.markdown +| ^ punctuation.definition.string.begin.markdown +| ^ punctuation.definition.string.end.markdown +| ^ punctuation.definition.metadata.end.markdown + +Here is a ![Image Alt Text]( + https://example .com /cat.gif (hello) ). +|^ meta.paragraph.markdown meta.image.inline.metadata.markdown - markup.underline +| ^^^^^^^^^^^^^^^ meta.paragraph.markdown meta.image.inline.metadata.markdown markup.underline.link.image.markdown +| ^ meta.paragraph.markdown meta.image.inline.metadata.markdown - markup.underline +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.paragraph.markdown - meta.image - markup.underline + +Here is a ![Image Ref Alt][1]. +| ^^^^^^^^^^^^^^^^ meta.image.reference.description.markdown +| ^^^ meta.image.reference.metadata.markdown +| ^^ punctuation.definition.image.begin.markdown +| ^ punctuation.definition.image.end.markdown +| ^ punctuation.definition.metadata.begin.markdown +| ^ markup.underline.link.markdown +| ^ punctuation.definition.metadata.end.markdown + + +# TEST: FOOTNOTES ############################################################# + +## https://michelf.ca/projects/php-markdown/extra/#footnotes + +That's some text with a footnote.[^1] +| ^^^^ meta.paragraph meta.link.reference.footnote.markdown-extra +| ^ punctuation.definition.link.begin +| ^^ meta.link.reference.literal.footnote-id +| ^ punctuation.definition.link.end + +Here is a footnote[^1][link][] or long[^longnote][link][]. +| ^^^^ meta.link.reference.footnote.markdown-extra +| ^^^^^^ meta.link.reference.literal.description.markdown +| ^^ meta.link.reference.literal.metadata.markdown +| ^^^^^^^^^^^ meta.link.reference.footnote.markdown-extra +| ^^^^^^^^ meta.link.reference.literal + +Here is a footnote [^footnote](not_link_dest). +| ^^^^^^^^^^^ meta.paragraph.markdown meta.link.reference.footnote.markdown-extra +| ^ punctuation.definition.link.begin.markdown +| ^^^^^^^^^ meta.link.reference.literal.footnote-id.markdown +| ^ punctuation.definition.link.end.markdown +| ^^^^^^^^^^^^^^^ meta.paragraph.markdown - meta.link + + +# TEST: COMMONMARK AUTOLINKS ################################################## + + +| <- meta.link.email.markdown punctuation.definition.link.begin.markdown - markup.underline +|^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.email.markdown markup.underline.link.markdown +| ^ meta.link.email.markdown - markup.underline +| ^ punctuation.separator.path.markdown +| ^ punctuation.separator.path.markdown +| ^ punctuation.definition.link.end.markdown + + +| <- meta.link.email.markdown punctuation.definition.link.begin.markdown - markup.underline +|^^^^^^^^^^^^^^^^^^^^^^ meta.link.email.markdown markup.underline.link.markdown +| ^ meta.link.email.markdown - markup.underline +| ^ punctuation.separator.path.markdown +| ^ punctuation.definition.link.end.markdown + + +| <- meta.link.inet.markdown punctuation.definition.link.begin.markdown - markup.underline +|^^^^^^^^^^^^^^^^^^^^ meta.link.inet.markdown markup.underline.link.markdown +| ^ meta.link.inet.markdown - markup.underline +| ^^^ punctuation.separator.path.markdown +| ^ punctuation.separator.path.markdown +| ^ punctuation.definition.link.end.markdown + + +| <- meta.link.inet.markdown punctuation.definition.link.begin.markdown - markup.underline +|^^^^^^^^^^^^^^^^^ meta.link.inet.markdown markup.underline.link.markdown +| ^ meta.link.inet.markdown - markup.underline +| ^^^ punctuation.separator.path.markdown +| ^ punctuation.separator.path.markdown +| ^ punctuation.definition.link.end.markdown + + +| <- meta.link.inet.markdown punctuation.definition.link.begin.markdown - markup.underline +|^^^^^^^^^^^^^^^ meta.link.inet.markdown markup.underline.link.markdown +| ^ meta.link.inet.markdown - markup.underline +| ^^^ punctuation.separator.path.markdown +| ^ punctuation.separator.path.markdown +| ^ punctuation.definition.link.end.markdown + + +| <- meta.link.inet.markdown punctuation.definition.link.begin.markdown - markup.underline +|^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.inet.markdown markup.underline.link.markdown +| ^ meta.link.inet.markdown - markup.underline +| ^^^ punctuation.separator.path.markdown +| ^ constant.character.escape.url.markdown punctuation.definition.escape.markdown +| ^^ constant.character.escape.url.markdown - punctuation +| ^ punctuation.separator.path.markdown + + +| <- meta.link.inet.markdown punctuation.definition.link.begin.markdown +|^^^^^^^ meta.link.inet.markdown markup.underline.link.markdown +| ^ meta.paragraph.markdown meta.link.inet.markdown punctuation.definition.link.end.markdown + + +| <- meta.paragraph.markdown meta.link.inet.markdown punctuation.definition.link.begin.markdown +|^^^^^^^^^^^^^^^^^^^^^^^^ meta.paragraph.markdown meta.link.inet.markdown markup.underline.link.markdown +| ^ meta.paragraph.markdown meta.link.inet.markdown punctuation.definition.link.end.markdown +| ^^^ punctuation.separator.path.markdown + + +| <- meta.link.inet.markdown punctuation.definition.link.begin.markdown +|^^^^^^^^^^ meta.link.inet.markdown markup.underline.link.markdown +| ^ meta.paragraph.markdown meta.link.inet.markdown punctuation.definition.link.end.markdown +| ^^^ punctuation.separator.path.markdown +| ^ punctuation.separator.path.markdown + + +| <- meta.link.inet.markdown punctuation.definition.link.begin.markdown +|^^^^^^^^^^^^^^^^^^ meta.link.inet.markdown markup.underline.link.markdown +| ^ meta.paragraph.markdown meta.link.inet.markdown punctuation.definition.link.end.markdown +| ^ punctuation.separator.path.markdown +| ^ punctuation.separator.path.markdown + + +| <- meta.link.inet.markdown punctuation.definition.link.begin.markdown +|^^^^^^^^^^^^^^^^^^ meta.link.inet.markdown markup.underline.link.markdown +| ^^^^^^ - meta.link +| ^^^ punctuation.separator.path.markdown +| ^ punctuation.separator.path.markdown + + +| <- meta.link.inet.markdown punctuation.definition.link.begin.markdown +|^^^^^^^^^^^^^^^^^^^^^^ meta.link.inet.markdown markup.underline.link.markdown +| ^ meta.paragraph.markdown meta.link.inet.markdown punctuation.definition.link.end.markdown +| ^^^ punctuation.separator.path.markdown +| ^ punctuation.separator.path.markdown + + +# TEST: GFM AUTOLINKS ######################################################### + +Visit ftp://intra%20net +| ^^^^^^^^^^^^^^^^^ meta.link.inet.markdown markup.underline.link +| ^^^ punctuation.separator.path.markdown +| ^ - constant +| ^ constant.character.escape.url.markdown punctuation.definition.escape.markdown +| ^^ constant.character.escape.url.markdown - punctuation +| ^^^ - constant + +Visit http://intra%20net +| ^^^^^^^^^^^^^^^^^^ meta.link.inet.markdown markup.underline.link +| ^^^ punctuation.separator.path.markdown +| ^ - constant +| ^ constant.character.escape.url.markdown punctuation.definition.escape.markdown +| ^^ constant.character.escape.url.markdown - punctuation +| ^^^ - constant + +Visit https://intra%20net +| ^^^^^^^^^^^^^^^^^^^ meta.link.inet.markdown markup.underline.link +| ^^^ punctuation.separator.path.markdown +| ^ - constant +| ^ constant.character.escape.url.markdown punctuation.definition.escape.markdown +| ^^ constant.character.escape.url.markdown - punctuation +| ^^^ - constant + +Visit www.intra%20net +| ^^^^^^^^^^^^^^^ meta.link.inet.markdown markup.underline.link +| ^ - constant +| ^ constant.character.escape.url.markdown punctuation.definition.escape.markdown +| ^^ constant.character.escape.url.markdown - punctuation +| ^^^ - constant + +Visit www.commonmark.org/help for more information. +| ^^^^^^^^^^^^^^^^^^^^^^^ meta.link.inet.markdown markup.underline.link +| ^ punctuation.separator.path.markdown +| ^^^^^^^^^^^^^^^^^^^^^^^ - markup.underline.link + +Visit www.commonmark.org. +| ^^^^^^^^^^^^^^^^^^ meta.paragraph meta.link.inet.markdown markup.underline.link +| ^^ - markup.underline.link + +Visit www.commonmark.org/a.b. +| ^^^^^^^^^^^^^^^^^^^^^^ meta.paragraph meta.link.inet.markdown markup.underline.link +| ^ - markup.underline.link +| ^ punctuation.separator.path.markdown + +www.google.com/search?q=(business))+ok +|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.inet.markdown markup.underline.link +| ^ punctuation.separator.path.markdown +| ^ punctuation.separator.path.markdown +| ^ - markup.underline.link + +www.google.com/search?q=Markup+(business) +|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.inet.markdown markup.underline.link +| ^ punctuation.separator.path.markdown +| ^ punctuation.separator.path.markdown + +www.commonmark.org/he +|^^^^^^^^^^^^^^^^^^^^ meta.link.inet.markdown markup.underline.link +| ^ punctuation.separator.path.markdown +| ^ - markup.underline.link + +http://commonmark.org +|^^^^^^^^^^^^^^^^^^^^ meta.link.inet.markdown markup.underline.link +| ^^^ punctuation.separator.path.markdown + +www.google.com/search?q=commonmark&hl=en +|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.inet.markdown markup.underline.link +| ^ punctuation.separator.path.markdown +| ^ punctuation.separator.path.markdown +| ^ punctuation.separator.path.markdown +| ^ - markup.underline.link + +www.google.com/search?q=commonmark&hl; +|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.inet.markdown markup.underline.link +| ^ punctuation.separator.path.markdown +| ^ punctuation.separator.path.markdown +| ^^^^ constant.character.entity.named.html - markup.underline.link + +www.google.com/search?q=commonmark&hl;&hl; +|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.inet.markdown markup.underline.link +| ^ punctuation.separator.path.markdown +| ^ punctuation.separator.path.markdown +| ^^^^^^^^ constant.character.entity.named.html - markup.underline.link + +www.google.com/search?q=commonmark&hl;! +|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.inet.markdown markup.underline.link +| ^^^^^^ - meta.link +| ^ punctuation.separator.path.markdown +| ^ punctuation.separator.path.markdown +| ^^^^ constant.character.entity.named.html - markup.underline.link + +www.google.com/search?q=commonmark&hl;f +|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.inet.markdown markup.underline.link +| ^ - meta.link +| ^ punctuation.separator.path.markdown +| ^ punctuation.separator.path.markdown +| ^^^^ - constant.character + +(Visit https://encrypted.google.com/search?q=Markup+(business)) +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.inet.markdown markup.underline.link +| ^^^ punctuation.separator.path.markdown +| ^ punctuation.separator.path.markdown +| ^ punctuation.separator.path.markdown +| ^^ - markup.underline.link + +Anonymous FTP is available at ftp://foo.bar.baz. +| ^^^^^^^^^^^^^^^^^ meta.link.inet.markdown markup.underline.link +| ^^^ punctuation.separator.path.markdown +| ^^ - markup.underline.link + +(see http://www.google.com/search?q=commonmark&hl=en) +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.inet.markdown markup.underline.link +| ^^^ punctuation.separator.path.markdown +| ^ punctuation.separator.path.markdown +| ^ punctuation.separator.path.markdown +| ^ punctuation.separator.path.markdown +| ^^ - markup.underline.link + +foo@bar.baz +| <- meta.link.email.markdown markup.underline.link.markdown +|^^^^^^^^^^ meta.link.email.markdown markup.underline.link.markdown +| ^ punctuation.separator.path.markdown +| ^ - meta.link - markup.underline.link + +hello@mail+xyz.example isn't valid, but hello+xyz@mail.example is. +|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.link - markup.underline.link +| ^^^^^^^^^^^^^^^^^^^^^^ meta.link.email.markdown markup.underline.link.markdown + + test@test.test.me +| <- - meta.link - markup.underline +|^^^^^^^^^^^^^^^^^ meta.link.email.markdown markup.underline.link.markdown +| ^ punctuation.separator.path.markdown +| ^ - meta.link - markup.underline.link + + a.b-c_d@a.b +| <- - meta.link - markup.underline +|^^^^^^^^^^^ meta.link.email.markdown markup.underline.link.markdown +| ^ punctuation.separator.path.markdown +| ^ - meta.link - markup.underline.link + +a.b-c_d@a.b. +|^^^^^^^^^^ markup.underline.link +| ^^ - markup.underline.link + + a.b-c_d@a.b- +| <- - meta.link - markup.underline +|^^^^^^^^^^^^^ - meta.link - markup.underline.link + + a.b-c_d@a.b_ +| <- - meta.link - markup.underline +|^^^^^^^^^^^^^ - meta.link - markup.underline.link + + +# TEST: HARD LINE BREAKS ###################################################### + +hard line break +| ^^ meta.hard-line-break punctuation.definition.hard-line-break +hard line break\ +| ^ meta.hard-line-break constant.character.escape +hard line break +| ^^^^^ meta.hard-line-break punctuation.definition.hard-line-break +soft line break +| ^^ - meta.hard-line-break +soft line break +| ^^ - meta.hard-line-break + +### foo +| ^^^ - meta.hard-line-break +### foo\ +| ^ - meta.hard-line-break + +`inline code with trailing spaces +| ^^^ - meta.hard-line-break +not a hard line break` + + +# TEST: CRITIC MARKUP ######################################################### + +This is an {++additional++} word in {++**bold**++}. +| ^^^^^^^^^^^^^^^^ markup.critic.addition.markdown +| ^^^ punctuation.definition.critic.begin.markdown - markup.inserted +| ^^^^^^^^^^ markup.inserted.critic.markdown +| ^^^ punctuation.definition.critic.end.markdown - markup.inserted +| ^^^ markup.critic.addition.markdown - markup.inserted - markup.bold +| ^^^^^^^^ markup.critic.addition.markdown markup.inserted.critic.markdown markup.bold.markdown +| ^^^ markup.critic.addition.markdown - markup.inserted +| ^^^ punctuation.definition.critic.begin.markdown +| ^^ punctuation.definition.bold.begin.markdown +| ^^ punctuation.definition.bold.end.markdown +| ^^^ punctuation.definition.critic.end.markdown + +This is an {++ multiline +addition ++} test. +| <- markup.critic.addition.markdown +|^^^^^^^^ markup.critic.addition.markdown markup.inserted.critic.markdown +| ^^^ markup.critic.addition.markdown - markup.inserted +| ^^^ punctuation.definition.critic.end.markdown +| ^^^^^^ - markup.critic + +Additional {++[Link](https://foo.bar)++} and {++![Image](images/image.png)++}. +| ^^^^^^^^^ - markup.critic +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.critic.addition.markdown +| ^^^^ - markup.critic +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.critic.addition.markdown +| ^^ - markup.critic +| ^^^ punctuation.definition.critic.begin.markdown +| ^^^^^^ meta.link.inline.description.markdown +| ^^^^^^^^^^^^^^^^^ meta.link.inline.metadata.markdown +| ^^^ punctuation.definition.critic.end.markdown +| ^^^ punctuation.definition.critic.begin.markdown +| ^^^^^^^^ meta.image.inline.description.markdown +| ^^^^^^^^^^^^^^^^^^ meta.image.inline.metadata.markdown +| ^^^ punctuation.definition.critic.end.markdown + +This is a {-- deletion --} and {~~substitute~>with~~striked~~text~~} or {~~~~old~~~>~~new~~~~}. +| ^^^^^^^^^^^^^^^^ markup.critic.deletion.markdown +| ^^^ punctuation.definition.critic.begin.markdown - markup.deleted +| ^^^^^^^^^^ markup.deleted.critic.markdown +| ^^^ punctuation.definition.critic.end.markdown - markup.deleted +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.critic.substitution.markdown +| ^^^ - markup.critic +| ^^^^^^^^^^^^^^^^^^^^^^ markup.critic.substitution.markdown +| ^^ - markup.critic +| ^^^ punctuation.definition.critic.begin.markdown - markup.deleted +| ^^^^^^^^^^ markup.deleted.critic.markdown +| ^^ punctuation.separator.critic.markdown - markup.deleted - markup.inserted +| ^^^^^^^^^^^^^^^^^^ markup.inserted.critic.markdown +| ^^^^^^^^^^ markup.strikethrough.markdown-gfm +| ^^^ punctuation.definition.critic.end.markdown - markup.inserted +| ^^^ punctuation.definition.critic.begin.markdown +| ^^ punctuation.definition.strikethrough.begin.markdown +| ^^^^^^^ markup.deleted.critic.markdown markup.strikethrough.markdown-gfm +| ^^ punctuation.definition.strikethrough.end.markdown +| ^^ punctuation.separator.critic.markdown +| ^^ punctuation.definition.strikethrough.begin.markdown +| ^^^^^^^ markup.inserted.critic.markdown markup.strikethrough.markdown-gfm +| ^^ punctuation.definition.strikethrough.end.markdown +| ^^^ punctuation.definition.critic.end.markdown + +No striked {~~~>~~} critics. +| ^^^^^^^^ markup.critic.substitution.markdown +| ^^^ punctuation.definition.critic.begin.markdown +| ^^ punctuation.separator.critic.markdown +| ^^^ punctuation.definition.critic.end.markdown +| ^^^^^^^^^^ - markup.critic + +No striked {~~~~>~~~} critics. +| ^^^^^^^^^^ markup.critic.substitution.markdown +| ^^^ punctuation.definition.critic.begin.markdown +| ^ - punctuation +| ^^ punctuation.separator.critic.markdown +| ^ - punctuation +| ^^^ punctuation.definition.critic.end.markdown +| ^^^^^^^^^^ - markup.critic + +No striked {~~~~~>~~~~} critics. +| ^^^^^^^^^^^^ markup.critic.substitution.markdown +| ^^^ punctuation.definition.critic.begin.markdown +| ^^ - punctuation +| ^^ punctuation.separator.critic.markdown +| ^^ - punctuation +| ^^^ punctuation.definition.critic.end.markdown +| ^^^^^^^^^^ - markup.critic + +No striked {~~~~~~>~~~~~} critics. +| ^^^^^^^^^^^^^^ markup.critic.substitution.markdown +| ^^^ punctuation.definition.critic.begin.markdown +| ^^^ - punctuation +| ^^ punctuation.separator.critic.markdown +| ^^^ - punctuation +| ^^^ punctuation.definition.critic.end.markdown +| ^^^^^^^^^^ - markup.critic + +No striked {~~~~~~~>~~~~~~} critics. +| ^^^^^^^^^^^^^^^^ markup.critic.substitution.markdown +| ^^^ punctuation.definition.critic.begin.markdown +| ^^^^ - punctuation +| ^^ punctuation.separator.critic.markdown +| ^^^^ - punctuation +| ^^^ punctuation.definition.critic.end.markdown +| ^^^^^^^^^^ - markup.critic + +This is a {>> comment <<}. +| ^^^^^^^^^^^^^^^ markup.critic.comment.markdown +| ^^^ punctuation.definition.critic.begin.markdown - comment +| ^^^^^^^^^ comment.critic.markdown +| ^^^ punctuation.definition.critic.end.markdown - comment +| ^ - markup.critic + +This is an {== information ==}{>> comment <<}. +| ^^^^^^^^^^^^^^^^^^^ markup.critic.highlight.markdown +| ^^^^^^^^^^^^^^^ markup.critic.comment.markdown +| ^^^ punctuation.definition.critic.begin.markdown - markup.info +| ^^^^^^^^^^^^^ markup.info.critic.markdown +| ^^^ punctuation.definition.critic.end.markdown - markup.info +| ^^^ punctuation.definition.critic.begin.markdown - comment +| ^^^^^^^^^ comment.critic.markdown +| ^^^ punctuation.definition.critic.end.markdown - comment +| ^^ - markup.critic + +This is a [[wiki link]]. +| ^^^^^^^^^^^^^ meta.link.reference.wiki.description.markdown +| ^^ punctuation.definition.link.begin.markdown +| ^^ punctuation.definition.link.end.markdown diff --git a/Markdown/syntax_test_multimarkdown.md b/Markdown/tests/syntax_test_multimarkdown.md similarity index 95% rename from Markdown/syntax_test_multimarkdown.md rename to Markdown/tests/syntax_test_multimarkdown.md index 2c3c094df5..f9b00f9e48 100644 --- a/Markdown/syntax_test_multimarkdown.md +++ b/Markdown/tests/syntax_test_multimarkdown.md @@ -31,5 +31,5 @@ T: ^^^^^^^^ meta.header.multimarkdown string.unquoted.multimarkdown T: <- meta.content.multimarkdown - meta.header.multimarkdown # Heading -| <- markup.heading punctuation.definition.heading -|^^^^^^^^ markup.heading +T: <- markup.heading punctuation.definition.heading +T:^^^^^^^ markup.heading