diff --git a/RestructuredText/.python-version b/RestructuredText/.python-version new file mode 100644 index 0000000000..24ee5b1be9 --- /dev/null +++ b/RestructuredText/.python-version @@ -0,0 +1 @@ +3.13 diff --git a/RestructuredText/Comments.tmPreferences b/RestructuredText/Comments.tmPreferences index 5bd28d4e39..3d3bcd0ffd 100644 --- a/RestructuredText/Comments.tmPreferences +++ b/RestructuredText/Comments.tmPreferences @@ -1,8 +1,6 @@ - name - Miscellaneous scope text.restructuredtext settings diff --git a/RestructuredText/Default.sublime-keymap b/RestructuredText/Default.sublime-keymap new file mode 100644 index 0000000000..35a940513c --- /dev/null +++ b/RestructuredText/Default.sublime-keymap @@ -0,0 +1,143 @@ +[ +// { +// "keys": ["ctrl+alt+l"], +// "command": "restructuredtext_encapsulate_literal", +// "context": +// [ +// { "key": "selector", "operand": "text.restructuredtext"}, +// { "key": "selection_empty", "operand": false, "match_all": true }, +// ] +// }, + +// { +// "keys": ["ctrl+alt+t"], +// "command": "restructuredtext_encapsulate_interpreted_text_role", +// "args": { +// "role_name": "term" +// }, +// "context": +// [ +// { "key": "selector", "operand": "text.restructuredtext"}, +// { "key": "selection_empty", "operand": false, "match_all": true }, +// ] +// }, + + // Auto-pair asterisks + { + "keys": ["*"], + "command": "insert_snippet", + "args": {"contents": "*${0:$SELECTION}*"}, + "context": [ + { "key": "setting.auto_match_enabled"}, + { "key": "selection_empty", "operand": false, "match_all": true }, + { "key": "selector", "operand": "text.restructuredtext - markup.raw" } + ] + }, + { + "keys": ["backspace"], + "command": "run_macro_file", + "args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"}, + "context": [ + { "key": "setting.auto_match_enabled" }, + { "key": "selection_empty", "match_all": true }, + { "key": "selector", "operator": "equal", "operand": "text.restructuredtext - markup.raw" }, + { "key": "preceding_text", "operator": "regex_contains", "operand": "\\*$", "match_all": true }, + { "key": "following_text", "operator": "regex_contains", "operand": "^\\*", "match_all": true } + ] + }, + + // Auto-pair colon + { + "keys": [":"], + "command": "insert_snippet", + "args": {"contents": ":${0:$SELECTION}:"}, + "context": [ + { "key": "setting.auto_match_enabled"}, + { "key": "selection_empty", "operand": false, "match_all": true }, + { "key": "selector", "operand": "text.restructuredtext - markup.raw" } + ] + }, + { + "keys": ["backspace"], + "command": "run_macro_file", + "args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"}, + "context": [ + { "key": "setting.auto_match_enabled" }, + { "key": "selection_empty", "match_all": true }, + { "key": "selector", "operator": "equal", "operand": "text.restructuredtext - markup.raw" }, + { "key": "preceding_text", "operator": "regex_contains", "operand": ":$", "match_all": true }, + { "key": "following_text", "operator": "regex_contains", "operand": "^:", "match_all": true } + ] + }, + + // Auto-pair underscore + { + "keys": ["_"], + "command": "insert_snippet", + "args": {"contents": "_${0:$SELECTION}_"}, + "context": [ + { "key": "setting.auto_match_enabled"}, + { "key": "selection_empty", "operand": false, "match_all": true }, + { "key": "selector", "operand": "text.restructuredtext - markup.raw" } + ] + }, + { + "keys": ["backspace"], + "command": "run_macro_file", + "args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"}, + "context": [ + { "key": "setting.auto_match_enabled" }, + { "key": "selection_empty", "match_all": true }, + { "key": "selector", "operator": "equal", "operand": "text.restructuredtext - markup.raw" }, + { "key": "preceding_text", "operator": "regex_contains", "operand": "_$", "match_all": true }, + { "key": "following_text", "operator": "regex_contains", "operand": "^_", "match_all": true } + ] + }, + + // Auto-pair backticks + { + "keys": ["`"], + "command": "insert_snippet", + "args": {"contents": "`$0`"}, + "context": [ + { "key": "setting.auto_match_enabled"}, + { "key": "selection_empty", "match_all": true }, + { "key": "selector", "operand": "text.restructuredtext - markup.raw - text.restructuredtext.embedded" }, + { "key": "preceding_text", "operator": "not_regex_contains", "operand": "[\\w`]$", "match_all": true }, + { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|\\.|,|$)", "match_all": true } + ] + }, + { + "keys": ["`"], + "command": "insert_snippet", + "args": {"contents": "`${0:$SELECTION}`"}, + "context": [ + { "key": "setting.auto_match_enabled"}, + { "key": "selection_empty", "operand": false, "match_all": true }, + { "key": "selector", "operand": "text.restructuredtext - markup.raw - text.restructuredtext.embedded" } + ] + }, + { + "keys": ["`"], + "command": "move", + "args": {"by": "characters", "forward": true}, + "context": [ + { "key": "setting.auto_match_enabled" }, + { "key": "selection_empty", "operand": true, "match_all": true }, + { "key": "selector", "operand": "text.restructuredtext markup.raw.inline - markup.raw.block - text.restructuredtext.embedded" }, + { "key": "following_text", "operator": "regex_contains", "operand": "^`", "match_all": true } + ] + }, + { + "keys": ["backspace"], + "command": "run_macro_file", + "args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"}, + "context": [ + { "key": "setting.auto_match_enabled" }, + { "key": "selection_empty", "match_all": true }, + { "key": "selector", "operator": "equal", "operand": "punctuation.definition.raw.begin.restructuredtext" }, + { "key": "preceding_text", "operator": "regex_contains", "operand": "`$", "match_all": true }, + { "key": "following_text", "operator": "regex_contains", "operand": "^`", "match_all": true } + ] + } +] diff --git a/RestructuredText/Fold.tmPreferences b/RestructuredText/Fold.tmPreferences new file mode 100644 index 0000000000..29a6df17d4 --- /dev/null +++ b/RestructuredText/Fold.tmPreferences @@ -0,0 +1,107 @@ + + + + scope + text.restructuredtext + settings + + foldScopes + + + begin + punctuation.section.block.begin + end + punctuation.section.block.end + + + begin + punctuation.definition.generic.begin + end + punctuation.definition.generic.end + + + begin + punctuation.definition.constant.begin + end + punctuation.definition.constant.end + + + begin + meta.fold.raw-code-directive.begin + end + meta.fold.raw-code-directive.end + + + begin + punctuation.definition.substitution.begin + end + punctuation.definition.substitution.end + + + begin + punctuation.definition.bold.begin + end + punctuation.definition.bold.end + + + begin + punctuation.definition.italic.begin + end + punctuation.definition.italic.end + + + begin + punctuation.definition.raw.begin + end + punctuation.definition.raw.end + + + begin + punctuation.definition.link.begin + end + punctuation.definition.link.end + + + begin + punctuation.definition.location.begin + end + punctuation.definition.location.end + + + begin + punctuation.definition.markup-interpreted.begin + end + punctuation.definition.markup-interpreted.end + + + begin + punctuation.definition.footnote-reference.begin + end + punctuation.definition.footnote-reference.end + + + + indentationFoldingEnabled + + + + diff --git a/RestructuredText/Main.sublime-menu b/RestructuredText/Main.sublime-menu new file mode 100644 index 0000000000..75badf0250 --- /dev/null +++ b/RestructuredText/Main.sublime-menu @@ -0,0 +1,112 @@ +[ + { + "id": "preferences", + "children": + [ + { + "caption": "Package Settings", + "id": "package-settings", + "children": + [ + { + "caption": "reStructuredText (reST)", + "children": + [ + { + "caption": "Docutils ∙ Reference ∙ Introduction", + "command": "open_url", + "args": { "url": "https://docutils.sourceforge.io/docs/ref/rst/introduction.html" } + }, + { + "caption": "Docutils ∙ Reference ∙ Markup Specification", + "command": "open_url", + "args": { "url": "https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html" } + }, + { + "caption": "Docutils ∙ Reference ∙ Markup Specification ∙ Tables", + "command": "open_url", + "args": { "url": "https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#tables" } + }, + { + "caption": "Docutils ∙ Reference ∙ Markup Specification ∙ Substitution References", + "command": "open_url", + "args": { "url": "https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#substitution-references" } + }, + { + "caption": "Docutils ∙ Reference ∙ Directives", + "command": "open_url", + "args": { "url": "https://docutils.sourceforge.io/docs/ref/rst/directives.html" } + }, + { + "caption": "Docutils ∙ Reference ∙ Interpreted Text Roles", + "command": "open_url", + "args": { "url": "https://docutils.sourceforge.io/docs/ref/rst/roles.html" } + }, + { + "caption": "Docutils ∙ User ∙ Quickstart", + "command": "open_url", + "args": { "url": "https://docutils.sourceforge.io/docs/user/rst/quickstart.html" } + }, + { + "caption": "Docutils ∙ User ∙ Examples", + "command": "open_url", + "args": { "url": "https://docutils.sourceforge.io/docs/user/rst/demo.html" } + }, + { + "caption": "Docutils ∙ User ∙ Quick Reference", + "command": "open_url", + "args": { "url": "https://docutils.sourceforge.io/docs/user/rst/quickref.html" } + }, + { "caption": "-" }, + { + "caption": "Sphinx ∙ Command Line Tools", + "command": "open_url", + "args": { "url": "https://www.sphinx-doc.org/en/master/man/index.html" } + }, + { + "caption": "Sphinx ∙ 'sphinx-build' Command Line", + "command": "open_url", + "args": { "url": "https://www.sphinx-doc.org/en/master/man/sphinx-build.html" } + }, + { + "caption": "Sphinx ∙ Documentation", + "command": "open_url", + "args": { "url": "https://www.sphinx-doc.org/en/master/" } + }, + { + "caption": "Sphinx ∙ Usage ∙ Configuration", + "command": "open_url", + "args": { "url": "https://www.sphinx-doc.org/en/master/usage/configuration.html" } + }, + { + "caption": "Sphinx ∙ Usage ∙ reST ∙ Directives", + "command": "open_url", + "args": { "url": "https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html" } + }, + { + "caption": "Sphinx ∙ Usage ∙ reST ∙ Directives ∙ Admonitions", + "command": "open_url", + "args": { "url": "https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#admonitions-messages-and-warnings" } + }, + { + "caption": "Sphinx ∙ Usage ∙ Referencing", + "command": "open_url", + "args": { "url": "https://www.sphinx-doc.org/en/master/usage/referencing.html" } + }, + { + "caption": "Sphinx ∙ Usage ∙ reST ∙ Interpreted Text Roles", + "command": "open_url", + "args": { "url": "https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html" } + }, + { + "caption": "Sphinx ∙ Glossary", + "command": "open_url", + "args": { "url": "https://www.sphinx-doc.org/en/master/glossary.html" } + } + ] + } + ] + } + ] + } +] diff --git a/RestructuredText/Symbol List - Citations.tmPreferences b/RestructuredText/Symbol List - Citations.tmPreferences new file mode 100644 index 0000000000..b4ef8cd80d --- /dev/null +++ b/RestructuredText/Symbol List - Citations.tmPreferences @@ -0,0 +1,19 @@ + + + + + scope + + settings + + showInIndexedSymbolList + 0 + showInSymbolList + 1 + + + diff --git a/RestructuredText/Symbol List - Explicit Hyperlink Targets.tmPreferences b/RestructuredText/Symbol List - Explicit Hyperlink Targets.tmPreferences new file mode 100644 index 0000000000..5995ced8c9 --- /dev/null +++ b/RestructuredText/Symbol List - Explicit Hyperlink Targets.tmPreferences @@ -0,0 +1,19 @@ + + + + + scope + + settings + + showInIndexedSymbolList + 0 + showInSymbolList + 1 + + + diff --git a/RestructuredText/Symbol List - Footnotes.tmPreferences b/RestructuredText/Symbol List - Footnotes.tmPreferences new file mode 100644 index 0000000000..ae22503367 --- /dev/null +++ b/RestructuredText/Symbol List - Footnotes.tmPreferences @@ -0,0 +1,19 @@ + + + + + scope + + settings + + showInIndexedSymbolList + 0 + showInSymbolList + 1 + + + diff --git a/RestructuredText/Symbol List - Sections.tmPreferences b/RestructuredText/Symbol List - Sections.tmPreferences new file mode 100644 index 0000000000..b45a561415 --- /dev/null +++ b/RestructuredText/Symbol List - Sections.tmPreferences @@ -0,0 +1,19 @@ + + + + + scope + + settings + + showInIndexedSymbolList + 1 + showInSymbolList + 1 + + + diff --git a/RestructuredText/main.py b/RestructuredText/main.py new file mode 100644 index 0000000000..375813a0df --- /dev/null +++ b/RestructuredText/main.py @@ -0,0 +1,5 @@ +#!/usr/bin/env python3 +# coding: utf-8 + + +from .src import * diff --git a/RestructuredText/reStructuredText.sublime-completions b/RestructuredText/reStructuredText.sublime-completions new file mode 100644 index 0000000000..feef352251 --- /dev/null +++ b/RestructuredText/reStructuredText.sublime-completions @@ -0,0 +1,351 @@ +{ + "scope": "text.restructuredtext - comment - source - text text", + "completions": + [ + // https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#comments + { + "trigger": "comment", + "contents": ".. ${1:comment}\n ${2:more comment}\n\n$0", + "annotation": "comment", + "kind": ["snippet", "s", "Snippet"], + "details": "" + }, + + + + // https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#sections + { + "trigger": "title", + "contents": "${1/./=/g}\n${1:title}\n${1/./=/g}\n\n$0", + "annotation": "section", + "kind": ["snippet", "s", "Snippet"], + "details": "" + }, + { + "trigger": "subtitle", + "contents": "${1/./-/g}\n${1:title}\n${1/./-/g}\n\n$0", + "annotation": "section", + "kind": ["snippet", "s", "Snippet"], + "details": "" + }, + { + "trigger": "headingequal", + "contents": "${1:heading}\n${1/./=/g}\n\n$0", + "annotation": "section", + "kind": ["snippet", "s", "Snippet"], + "details": "" + }, + { + "trigger": "headingplus", + "contents": "${1:heading}\n${1/./+/g}\n\n$0", + "annotation": "section", + "kind": ["snippet", "s", "Snippet"], + "details": "" + }, + { + "trigger": "headingminus", + "contents": "${1:heading}\n${1/./-/g}\n\n$0", + "annotation": "section", + "kind": ["snippet", "s", "Snippet"], + "details": "" + }, + { + "trigger": "headingdoublequote", + "contents": "${1:heading}\n${1/./\"/g}\n\n$0", + "annotation": "section", + "kind": ["snippet", "s", "Snippet"], + "details": "" + }, + { + "trigger": "headingsinglequote", + "contents": "${1:heading}\n${1/./'/g}\n\n$0", + "annotation": "section", + "kind": ["snippet", "s", "Snippet"], + "details": "" + }, + { + "trigger": "headingbacktick", + "contents": "${1:heading}\n${1/./`/g}\n\n$0", + "annotation": "section", + "kind": ["snippet", "s", "Snippet"], + "details": "" + }, + { + "trigger": "headingtilde", + "contents": "${1:heading}\n${1/./~/g}\n\n$0", + "annotation": "section", + "kind": ["snippet", "s", "Snippet"], + "details": "" + }, + + + + // https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#strong-emphasis + { + "trigger": "bold", + "contents": "**${1:text}**", + "annotation": "text style", + "kind": ["snippet", "s", "Snippet"], + "details": "" + }, + { + "trigger": "strongemphasis", + "contents": "**${1:text}**", + "annotation": "text style", + "kind": ["snippet", "s", "Snippet"], + "details": "" + }, + + + + // https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#emphasis + { + "trigger": "italic", + "contents": "*${1:text}*", + "annotation": "text style", + "kind": ["snippet", "s", "Snippet"], + "details": "" + }, + { + "trigger": "emphasis", + "contents": "*${1:text}*", + "annotation": "text style", + "kind": ["snippet", "s", "Snippet"], + "details": "" + }, + + + + // https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#inline-literals + { + "trigger": "literal", + "contents": "``${1:text}``", + "annotation": "inline literal", + "kind": ["snippet", "s", "Snippet"], + "details": "" + }, + + + + // https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#bullet-lists + { + "trigger": "list", + "contents": "* ${1:text}\n* ${2:text}\n* ${3:text}\n\n$0", + "annotation": "unordered list", + "kind": ["snippet", "s", "Snippet"], + "details": "" + }, + + + + // https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#enumerated-lists + { + "trigger": "listn", + "contents": "1. ${1:item}\n2. ${2:item}\n3. ${3:item}\n\n$0", + "annotation": "ordered list", + "kind": ["snippet", "s", "Snippet"], + "details": "" + }, + { + "trigger": "listan", + "contents": "#. ${1:item}\n#. ${2:item}\n#. ${3:item}\n\n$0", + "annotation": "auto-ordered list", + "kind": ["snippet", "s", "Snippet"], + "details": "" + }, + { + "trigger": "listdef", + "contents": "${1:term}\n${1/./ /g}${2:definition}\n\n$0", + "annotation": "definition list", + "kind": ["snippet", "s", "Snippet"], + "details": "" + }, + { + "trigger": "listfield", + "contents": ":${1:term}: ${2:field}\n\n$0", + "annotation": "field list", + "kind": ["snippet", "s", "Snippet"], + "details": "" + }, + + + + // https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#directives + { + "trigger": "image", + "contents": ".. image:: ${1:path}\n\n$0", + "annotation": "directive", + "kind": ["snippet", "s", "Snippet"], + "details": "" + }, + { + "trigger": "figure", + "contents": ".. figure:: ${1:path}\n\n ${2:caption}\n\n$0", + "annotation": "directive", + "kind": ["snippet", "s", "Snippet"], + "details": "" + }, + + + + // https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#directives + { + "trigger": "attention", + "contents": ".. attention:: ${1:note}\n\n$0", + "annotation": "admonition directive", + "kind": ["snippet", "s", "Snippet"], + "details": "" + }, + { + "trigger": "caution", + "contents": ".. caution:: ${1:note}\n\n$0", + "annotation": "admonition directive", + "kind": ["snippet", "s", "Snippet"], + "details": "" + }, + { + "trigger": "danger", + "contents": ".. danger:: ${1:note}\n\n$0", + "annotation": "admonition directive", + "kind": ["snippet", "s", "Snippet"], + "details": "" + }, + { + "trigger": "error", + "contents": ".. error:: ${1:note}\n\n$0", + "annotation": "admonition directive", + "kind": ["snippet", "s", "Snippet"], + "details": "" + }, + { + "trigger": "hint", + "contents": ".. hint:: ${1:note}\n\n$0", + "annotation": "admonition directive", + "kind": ["snippet", "s", "Snippet"], + "details": "" + }, + { + "trigger": "important", + "contents": ".. important:: ${1:note}\n\n$0", + "annotation": "admonition directive", + "kind": ["snippet", "s", "Snippet"], + "details": "" + }, + { + "trigger": "note", + "contents": ".. note:: ${1:note}\n\n$0", + "annotation": "admonition directive", + "kind": ["snippet", "s", "Snippet"], + "details": "" + }, + { + "trigger": "tip", + "contents": ".. tip:: ${1:note}\n\n$0", + "annotation": "admonition directive", + "kind": ["snippet", "s", "Snippet"], + "details": "" + }, + { + "trigger": "warning", + "contents": ".. warning:: ${1:note}\n\n$0", + "annotation": "admonition directive", + "kind": ["snippet", "s", "Snippet"], + "details": "" + }, + + + + // https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#bibliographic-fields + { + "trigger": "bibliographicfields", + "contents": ":Abstract: ${1:topic}\n:Address: ${2:address}\n:Author: ${3:author}\n:Authors: ${4:Doe, Jane; Doe, John}\n:Contact: ${5:contact (email OR mailing address)}\n:Copyright: ${6:copyright}\n:Date: ${7:date}\n:Dedication: ${8:topic}\n:Organization: ${9:organization}\n:Revision: ${10:revision (number)}\n:Status: ${11:Draft OR Final OR Work in Progress}\n:Version: ${12:version (semver)}\n\n$0", + "annotation": "bibliographic fields", + "kind": ["snippet", "s", "Snippet"], + "details": "" + }, + { + "trigger": "abstract", + "contents": ":Abstract: ${1:topic}\n\n$0", + "annotation": "bibliographic field", + "kind": ["snippet", "s", "Snippet"], + "details": "" + }, + { + "trigger": "address", + "contents": ":Address: ${1:address}\n\n$0", + "annotation": "bibliographic field", + "kind": ["snippet", "s", "Snippet"], + "details": "" + }, + { + "trigger": "author", + "contents": ":Author: ${1:author}\n\n$0", + "annotation": "bibliographic field", + "kind": ["snippet", "s", "Snippet"], + "details": "" + }, + { + "trigger": "authors", + "contents": ":Authors: ${1:Doe, Jane; Doe, John}\n\n$0", + "annotation": "bibliographic field", + "kind": ["snippet", "s", "Snippet"], + "details": "" + }, + { + "trigger": "contact", + "contents": ":Contact: ${1:contact (email OR mailing address)}\n\n$0", + "annotation": "bibliographic field", + "kind": ["snippet", "s", "Snippet"], + "details": "" + }, + { + "trigger": "copyright", + "contents": ":Copyright: ${1:copyright}\n\n$0", + "annotation": "bibliographic field", + "kind": ["snippet", "s", "Snippet"], + "details": "" + }, + { + "trigger": "date", + "contents": ":Date: ${1:date}\n\n$0", + "annotation": "bibliographic field", + "kind": ["snippet", "s", "Snippet"], + "details": "" + }, + { + "trigger": "dedication", + "contents": ":Dedication: ${1:topic}\n\n$0", + "annotation": "bibliographic field", + "kind": ["snippet", "s", "Snippet"], + "details": "" + }, + { + "trigger": "organization", + "contents": ":organization: ${1:organization}\n\n$0", + "annotation": "bibliographic field", + "kind": ["snippet", "s", "Snippet"], + "details": "" + }, + { + "trigger": "revision", + "contents": ":Revision: ${1:revision (number)}\n\n$0", + "annotation": "bibliographic field", + "kind": ["snippet", "s", "Snippet"], + "details": "" + }, + { + "trigger": "status", + "contents": ":Status: ${1:Draft OR Final OR Work in Progress}\n\n$0", + "annotation": "bibliographic field", + "kind": ["snippet", "s", "Snippet"], + "details": "" + }, + { + "trigger": "version", + "contents": ":Version: ${1:version (semver)}\n\n$0", + "annotation": "bibliographic field", + "kind": ["snippet", "s", "Snippet"], + "details": "" + } + ] +} diff --git a/RestructuredText/reStructuredText.sublime-settings b/RestructuredText/reStructuredText.sublime-settings index b3dd498dea..b912ed1e37 100644 --- a/RestructuredText/reStructuredText.sublime-settings +++ b/RestructuredText/reStructuredText.sublime-settings @@ -1,3 +1,11 @@ { + "auto_complete_selector": "text.restructuredtext - comment - source - text text", + "detect_indentation": false, "set_unsaved_view_name_for_syntax": true, + // for details compare the "whitespace" sub-section + // of the "syntax-details" section of the documentation at + // https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#whitespace + "tab_size": 8, + "translate_tabs_to_spaces": true, + "use_tab_stops": true } diff --git a/RestructuredText/reStructuredText.sublime-syntax b/RestructuredText/reStructuredText.sublime-syntax index 3aa1dba8b1..e4620dd23b 100644 --- a/RestructuredText/reStructuredText.sublime-syntax +++ b/RestructuredText/reStructuredText.sublime-syntax @@ -1,220 +1,1853 @@ %YAML 1.2 --- -# http://www.sublimetext.com/docs/3/syntax.html -name: reStructuredText -comment: syntax highlighting for reStructuredText http://docutils.sourceforge.net, based on rst mode from jEdit +# https://docutils.sourceforge.io/docs/user/rst/quickref.html +# https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html +# https://docutils.sourceforge.io/docs/ref/rst/directives.html +# https://docutils.sourceforge.io/docs/ref/doctree.html +# http://www.sublimetext.com/docs/syntax.html + +name: reStructuredText (reST) +scope: text.restructuredtext +version: 2 + file_extensions: - rst - rest -scope: text.restructuredtext + +###[ CONTEXTS ]################################################################ + contexts: + + prototype: + # NOTE: Comments are not part of prototype, but regular explicit markup + # blocks, i.e. body elements. + - include: merge-conflict-markers + main: - - match: '^(?=(\s*)\S)' - push: - - meta_content_scope: meta.paragraph.restructuredtext - - match: ^(?!\1(?=\S)) - pop: true - - include: inline - inline: - - match: '^(\s*)((\.\.)\s+raw(::)) html' - comment: directives.html - captures: - 2: meta.directive.restructuredtext + - include: restructuredtext + +###[ RESTRUCTUREDTEXT ]######################################################## + + restructuredtext: + - include: between-empty-lines + - include: paragraphs + + paragraphs: + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#paragraphs + + - meta_include_prototype: false + - match: ^(?=([[:blank:]]*)\S) + push: paragraph-body + + paragraph-body: + - meta_content_scope: meta.paragraph.restructuredtext + - match: '^(?!\1(?=\S))' + pop: 1 + - include: body-elements + - include: inline-markup + + between-empty-lines: + - match: ^\n + branch_point: between-empty-lines + branch: + - expect-empty-comment-or-section-transition-or-block-quote + - immediately-pop + + expect-empty-comment-or-section-transition-or-block-quote: + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#empty-comments + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#transitions + + - meta_include_prototype: false + - match: ^(\.\.)\n + captures: + 1: + comment.block.empty.restructuredtext + punctuation.definition.comment.restructuredtext + set: expect-empty-line + - match: ^({{section_title_adornment_or_transition_mark}}{4,})\n + captures: + 1: + meta.separator.section-transition.restructuredtext + punctuation.separator.section.restructuredtext + set: expect-empty-line + - match: ^(?=([[:blank:]]+)(?!\.\.)\S) + set: block-quote + - match: ^ + fail: between-empty-lines + + block-quote: + - meta_include_prototype: false + + # NOTE: contrary to most other body elements, indentation for block-quotes + # must be non-zero + - match: ^(?=([[:blank:]]+)(?!\.\.)\S) + push: block-quote-body + - match: '' + set: expect-empty-line + + block-quote-body: + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#block-quotes + + # TODO: multiple block quotes may occur consecutively if ended with attribution + # TODO: empty comments may be used to terminate preceding constructs or separate block quotes + + - meta_include_prototype: false + - meta_content_scope: markup.quote.block.restructuredtext + # NOTE: not same but less indentation, as the referenced indentation is + # non-zero and block-quotes continue with same indentation + - match: ^(?!\1(?=\S)) + pop: 1 + + # NOTE: unfortunately the SublimeHQ syntax engine does not support combining + # pop with embed when using a match + + # three dashes + # - match: '^(\1)(-{3})([[:blank:]]*)(?=\S)' + # captures: + # 2: punctuation.definition.quote-attribution.restructuredtext + # pop: 1 + # embed: scope:text.plain + # embed_scope: meta.quote.attribution.restructuredtext + # escape: ^(?!\1[ ]{3}\2(?=\S)) + + # two dashes + # - match: '^(\1)(-{2})([[:blank:]]*)(?=\S)' + # captures: + # 2: punctuation.definition.quote-attribution.restructuredtext + # pop: 1 + # embed: scope:text.plain + # embed_scope: meta.quote.attribution.restructuredtext + # escape: ^(?!\1[ ]{2}\2(?=\S)) + + # one em-dash + # - match: '^(\1)(—)([[:blank:]]*)(?=\S)' + # captures: + # 2: punctuation.definition.quote-attribution.restructuredtext + # pop: 1 + # embed: scope:text.plain + # embed_scope: meta.quote.attribution.restructuredtext + # escape: ^(?!\1[ ]\2(?=\S)) + + - include: body-elements + - include: inline-markup + + expect-empty-line: + - meta_include_prototype: false + - match: ^\n + pop: 1 + - match: ^ + fail: between-empty-lines + +###[ MERGE CONFLICT MARKERS ]################################################## + + merge-conflict-markers: + # see also: Diff.sublime-syntax#conflict-markers + - match: '^(<{7})(?:\s+(\S.*?))?{{end_of_line}}' + scope: meta.block.conflict.begin.diff + captures: + 1: punctuation.section.block.begin.diff + 2: entity.name.section.diff + - match: '^(>{7})(?:\s+(\S.*?))?{{end_of_line}}' + scope: meta.block.conflict.end.diff + captures: + 1: punctuation.section.block.end.diff + 2: entity.name.section.diff + - match: '^(\|{7}|={7})(?:\s+(\S.*?))?{{end_of_line}}' + scope: meta.block.conflict.separator.diff + captures: + 1: punctuation.section.block.diff + 2: entity.name.section.diff + +###[ BODY ELEMENTS ]########################################################### + + body-elements: + - include: explicit-markup-blocks + # NOTE: `block-quote` is in `between-empty-lines` + - include: doctest-blocks + - include: tables + - include: lists + - include: line-blocks + - include: section-headings + - include: literal-blocks + +###[ BODY ELEMENTS / SECTIONS ]################################################ + + section-headings: + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#sections + + - match: '{{maybe_section_heading_ahead}}' + branch_point: section-headings + branch: + - section-adornment-heading-adornment-1 + - section-heading-adornment-1 + + section-adornment-heading-adornment-1: + - match: '^({{section_title_adornment_or_transition_mark}}{3,})$\n' + scope: markup.heading.restructuredtext + captures: + 1: punctuation.definition.heading.restructuredtext + set: section-adornment-heading-adornment-2 + - match: '^' + fail: section-headings + + section-adornment-heading-adornment-2: + # NOTE: Section headings with an overline and an underline may be inset, + # i.e. have leading and/or trailing whitespace. + + - match: '^(?=$|{{section_title_adornment_or_transition_mark}})' + fail: section-headings + - match: '^[[:blank:]]*(.+)[[:blank:]]*$\n' + scope: markup.heading.restructuredtext + captures: + 1: entity.name.section.restructuredtext + set: section-adornment-heading-adornment-3 + - match: '^' + fail: section-headings + + section-adornment-heading-adornment-3: + - match: '^({{section_title_adornment_or_transition_mark}}{3,})$\n' + scope: markup.heading.restructuredtext + captures: + 1: punctuation.definition.heading.restructuredtext + pop: 1 + - match: '^' + fail: section-headings + + section-heading-adornment-1: + # NOTE: Section headings that only have an underline may not have leading + # whitespace. + + - match: '^(?:$\n|(?=\S))' + set: section-heading-adornment-2 + - match: '^' + fail: section-headings + + section-heading-adornment-2: + - match: '^(.*)$\n' + scope: markup.heading.restructuredtext + captures: + 1: entity.name.section.restructuredtext + set: section-heading-adornment-3 + - match: '^' + fail: section-headings + + section-heading-adornment-3: + - match: '^({{section_title_adornment_or_transition_mark}}{3,})$\n' + scope: markup.heading.restructuredtext + captures: + 1: punctuation.definition.heading.restructuredtext + pop: 1 + - match: '^' + fail: section-headings + +###[ BODY ELEMENTS / LITERAL BLOCKS ]########################################## + + literal-blocks: + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#literal-blocks + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#indented-literal-blocks + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#quoted-literal-blocks + + # TODO: when attached to the end of the preceding paragraph + # TODO: quoted form with same symbols as heading adornments + # TODO: content between empty lines + + - match: '^()(::)$' # NOTE: DO NOT REMOVE first capturing group, as it's needed to pop correctly! + captures: + 2: punctuation.definition.raw.restructuredtext + push: literal-block-body + - match: '^([[:blank:]]*)\b.+(?::[ ](::)|(::))' + captures: + 2: punctuation.definition.raw.restructuredtext + 3: punctuation.definition.raw.restructuredtext + push: literal-block-body + + literal-block-body: + - meta_scope: meta.raw.block.restructuredtext + - meta_content_scope: markup.raw.block.restructuredtext + - match: '(?=^({{section_title_adornment_or_transition_mark}})\s+)' + set: literal-block-body-quoted-form + - match: '{{less_or_same_indentation_ahead}}' + pop: 1 + - include: explicit-markup-block-pop + # NOTE: no inline-markup! + + literal-block-body-quoted-form: + - meta_scope: meta.raw.block.quoted-form.restructuredtext + - meta_content_scope: markup.raw.block.restructuredtext + - match: '^(?!{{section_title_adornment_or_transition_mark}})' + pop: 1 + - match: '^({{section_title_adornment_or_transition_mark}})\s+' + captures: + 1: punctuation.definition.raw.restructuredtext + - include: explicit-markup-block-pop + # NOTE: no inline-markup! + +###[ BODY ELEMENTS / DOCTEST BLOCKS ]########################################## + + doctest-blocks: + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#doctest-blocks + + - match: '^(>>>)[ ]' + captures: + 1: punctuation.definition.generic.restructuredtext + embed: scope:source.python + escape: (?=^{{end_of_line}}) # empty-line-pop + embed_scope: + text.restructuredtext.embedded.python + source.python.embedded.restructuredtext + +###[ BODY ELEMENTS / TABLES ]################################################## + + tables: + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#tables + + - include: grid-tables + - include: simple-tables + + grid-tables: + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#grid-tables + + - match: '\+(?:[-=]+\+)+' + scope: + markup.other.table.restructuredtext + punctuation.definition.table.restructuredtext + push: grid-table-body + + grid-table-body: + - meta_content_scope: markup.other.table.restructuredtext + - match: '^(?!\+|\|)' + pop: 1 + - match: '\+(?:[-=]+\+)+' + scope: punctuation.definition.table.restructuredtext + - match: '(?:^|[^\\])(\|)' + captures: + 1: punctuation.definition.table.restructuredtext + - include: inline-markup + + simple-tables: + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#simple-tables + + # TODO: no empty line after header row separator in simple tables + + - match: '\+=[+=]+' + scope: + markup.other.table.restructuredtext + punctuation.definition.table.restructuredtext + +###[ BODY ELEMENTS / LINE BLOCKS ]############################################# + + line-blocks: + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#line-blocks + + - match: |- + (?x) + ^ + ([[:blank:]]*) + (\|) + (?=[ ]\S+) + captures: + 2: punctuation.definition.generic.restructuredtext + push: line-block-body + + line-block-body: + - meta_scope: + meta.block.restructuredtext + markup.quote.line-block.restructuredtext + - match: '^(?!\1[[:blank:]]+)[[:blank:]]*(\|)\s*' + captures: + 1: punctuation.definition.generic.restructuredtext + - match: '{{less_or_same_indentation_ahead}}' + pop: 1 + - include: explicit-markup-block-pop + - include: empty-line-pop + - include: inline-markup + +###[ BODY ELEMENTS / EXPLICIT MARKUP BLOCKS ]################################## + + explicit-markup-blocks: + # TODO: empty line before other element following, optional if another explicit markup block + - include: footnotes + - include: citations + - include: explicit-hyperlink-targets + - include: directives + - include: substitution-definitions + - include: comments + + footnotes: + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#footnotes + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#auto-numbered-footnotes + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#auto-symbol-footnotes + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#mixed-manual-and-auto-numbered-footnotes + + - match: |- + (?x) + ^ + ({{two_dots}})[ ] + ((\[) + ( + ( (\#)? [^\]]* ) + | {{footnote_mark}} + ) + (\])) + [[:blank:]]+ + (?=\S+) + scope: meta.link.footnote.def.restructuredtext + captures: + 1: punctuation.definition.link.restructuredtext + 2: constant.other.footnote.link.restructuredtext + 3: punctuation.definition.constant.begin.restructuredtext + 6: punctuation.definition.constant.restructuredtext + 7: punctuation.definition.constant.end.restructuredtext + push: footnote-body + + footnote-body: + - meta_content_scope: + meta.link.footnote.def.restructuredtext + meta.string.restructuredtext + string.other.footnote.restructuredtext + - match: '^(?![[:blank:]]{3,})(?=[[:blank:]]{0,2}\S+)' + pop: 1 + - include: explicit-markup-block-pop + + citations: + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#citations + + - match: |- + (?x) + ^ + ({{two_dots}})[ ] + ((\[) + [[:alpha:]][[:alnum:]]* + (\]_?)) + [[:blank:]]+ + (?=\S+) + scope: meta.link.citation.def.restructuredtext + captures: + 1: punctuation.definition.link.restructuredtext + 2: constant.other.citation.link.restructuredtext + 3: punctuation.definition.constant.begin.restructuredtext + 4: punctuation.definition.constant.end.restructuredtext + push: citation-body + + citation-body: + - meta_content_scope: + meta.link.citation.def.restructuredtext + meta.string.restructuredtext + string.other.citation.restructuredtext + - match: '^(?![[:blank:]]{3,})(?=[[:blank:]]{0,2}\S+)' + pop: 1 + - include: explicit-markup-block-pop + + explicit-hyperlink-targets: + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#hyperlink-targets + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#anonymous-hyperlinks + # also compare: https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#implicit-hyperlink-targets + + - match: |- + (?x) + ^ + (_{2}) + (?: + (?=$\n?) + | [[:blank:]]+ (?=\S) + ) + scope: meta.link.target.restructuredtext + captures: + 1: + meta.link.target.anchor.restructuredtext + punctuation.definition.link-target.restructuredtext + push: explicit-hyperlink-target-body + - match: |- + (?x) + ^ + ({{two_dots}})[ ] + ( + (_{2}) + | (_)((`)([^`]+)(`)) + | (_)([^:]+) + ) + (:) + (?: + (?=$\n?) + | [[:blank:]]+ (?=\S) + ) + scope: meta.link.target.restructuredtext + captures: + 1: punctuation.definition.link.restructuredtext + 2: meta.link.target.anchor.restructuredtext + 3: punctuation.definition.link-target.restructuredtext + 4: punctuation.definition.link-target.restructuredtext + 5: meta.link.target.description.restructuredtext + 6: punctuation.definition.generic.begin.restructuredtext + 7: markup.raw.inline.restructuredtext + 8: punctuation.definition.generic.end.restructuredtext + 9: punctuation.definition.link-target.restructuredtext + 10: meta.link.target.description.restructuredtext + 11: punctuation.separator.key-value.restructuredtext + push: explicit-hyperlink-target-body + + explicit-hyperlink-target-body: + # TODO: fix for links beginning with `../` on next line, should not be comment + # TODO: differentiate between link and paragraph + # TODO: do not highlight leading whitespace with `markup.underline.link` + # TODO: spaces must be escaped + # TODO: trailing underscore must be escaped + - meta_content_scope: + meta.link.target.address.restructuredtext + meta.string.restructuredtext + string.other.link-target-block.restructuredtext + markup.underline.link.restructuredtext + - include: explicit-markup-block-pop + - include: inline-markup + + directives: + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#directives + # https://docutils.sourceforge.io/docs/ref/rst/directives.html + + - include: raw-code-directives + - include: other-directives + + directive-options-field-list: + - match: |- # char value + (?x) + {{three_spaces_indentation}} + ( + ((:)(escape | quote)(:)) + ([ ]) + (.) + (.*) + ) + $\n? + captures: + 1: + meta.directive.option.restructuredtext + meta.field-list.item.restructuredtext + 2: meta.mapping.key.restructuredtext + 3: punctuation.definition.generic.begin.restructuredtext + 4: entity.name.other.key.restructuredtext + 5: punctuation.definition.generic.end.restructuredtext + 6: + meta.mapping.restructuredtext + meta.separator.key-value.restructuredtext + 7: + meta.mapping.value.restructuredtext + markup.raw.inline.restructuredtext + 8: invalid.illegal.expected-newline.restructuredtext + - match: |- # unquoted string value + (?x) + {{three_spaces_indentation}} + ( + ( + (:) + ( + alt + | class | code + | end-before + | figclass | figname | file + | language + | name + | prefix + | start-after | subtitle | suffix + | target + | url + ) + (:) + ) + ([ ]) + (.*) + ) + $\n? + captures: + 1: + meta.directive.option.restructuredtext + meta.field-list.item.restructuredtext + 2: meta.mapping.key.restructuredtext + 3: punctuation.definition.generic.begin.restructuredtext + 4: entity.name.other.key.restructuredtext + 5: punctuation.definition.generic.end.restructuredtext + 6: + meta.mapping.restructuredtext + meta.separator.key-value.restructuredtext + 7: + meta.mapping.value.restructuredtext + meta.string.restructuredtext + string.unquoted.restructuredtext + - match: |- # integer number value + (?x) + {{three_spaces_indentation}} + ( + ( + (:) + ( + depth + | end-line + | header-rows + | number-lines + | stub-columns | start | start-line + | tab-width + ) + (:) + ) + ([ ]) + (\d{1,4}) + ) + $\n? + captures: + 1: + meta.directive.option.restructuredtext + meta.field-list.item.restructuredtext + 2: meta.mapping.key.restructuredtext + 3: punctuation.definition.generic.begin.restructuredtext + 4: entity.name.other.key.restructuredtext + 5: punctuation.definition.generic.end.restructuredtext + 6: + meta.mapping.restructuredtext + meta.separator.key-value.restructuredtext + 7: + meta.mapping.value.restructuredtext + meta.number.integer.decimal.restructuredtext + constant.numeric.value.restructuredtext + - match: |- # flags with no value + (?x) + {{three_spaces_indentation}} + ( + (:) + (keepspace | literal | local | ltrim | number-lines | rtrim | trim) + (:) + ) + $\n? + captures: + 1: + meta.directive.option.restructuredtext + meta.field-list.item.restructuredtext + meta.mapping.key.restructuredtext + 2: punctuation.definition.generic.begin.restructuredtext + 3: entity.name.other.key.restructuredtext + 4: punctuation.definition.generic.end.restructuredtext + - match: |- + (?x) + {{three_spaces_indentation}} + ( + ((:)(align)(:)) + ([ ]) + (top|middle|bottom|left|center|right) + ) + $\n? + captures: + 1: + meta.directive.option.restructuredtext + meta.field-list.item.restructuredtext + 2: meta.mapping.key.restructuredtext + 3: punctuation.definition.generic.begin.restructuredtext + 4: entity.name.other.key.restructuredtext + 5: punctuation.definition.generic.end.restructuredtext + 6: + meta.mapping.restructuredtext + meta.separator.key-value.restructuredtext + 7: + meta.mapping.value.restructuredtext + meta.string.restructuredtext + string.unquoted.restructuredtext + constant.language.directive-option-value.restructuredtext + - match: |- + (?x) + {{three_spaces_indentation}} + ( + ((:)(backlinks)(:)) + ([ ]) + (entry|top|none) + ) + $\n? + captures: + 1: + meta.directive.option.restructuredtext + meta.field-list.item.restructuredtext + 2: meta.mapping.key.restructuredtext + 3: punctuation.definition.generic.begin.restructuredtext + 4: entity.name.other.key.restructuredtext + 5: punctuation.definition.generic.end.restructuredtext + 6: + meta.mapping.restructuredtext + meta.separator.key-value.restructuredtext + 7: + meta.mapping.value.restructuredtext + meta.string.restructuredtext + string.unquoted.restructuredtext + constant.language.directive-option-value.restructuredtext + - match: |- # constant or char value + (?x) + {{three_spaces_indentation}} + ( + ((:)(delim)(:)) + ([ ]) + (?:(tab|space) | (.)(.*) ) + ) + $\n? + captures: + 1: + meta.directive.option.restructuredtext + meta.field-list.item.restructuredtext + 2: meta.mapping.key.restructuredtext + 3: punctuation.definition.generic.begin.restructuredtext + 4: entity.name.other.key.restructuredtext + 5: punctuation.definition.generic.end.restructuredtext + 6: + meta.mapping.restructuredtext + meta.separator.key-value.restructuredtext + 7: + meta.mapping.value.restructuredtext + meta.string.restructuredtext + string.unquoted.restructuredtext + constant.language.directive-option-value.restructuredtext + 8: + meta.mapping.value.restructuredtext + markup.raw.inline.restructuredtext + 9: invalid.illegal.expected-newline.restructuredtext + - match: |- + (?x) + {{three_spaces_indentation}} + ( + ((:)(encoding)(:)) + ([ ]) + ( # https://docs.python.org/3/library/codecs.html#standard-encodings + ascii + | utf_8 | utf_8_sig | utf_16 | utf_32 + | euc_jp | eucjp | ujis | u-jis | euc_jis_2004 | euc_jisx0213 # japanese + | shift_jis | shift_jis_2004 | shift_jisx0213 + | euc_kr | euckr | korean # korean + | gb2312 | chinese | hz | hzgb | hz-gb | hz-gb-2312 # simplified chinese + | big5 | big5hkscs # traditional chinese + ) + ) + $\n? + captures: + 1: + meta.directive.option.restructuredtext + meta.field-list.item.restructuredtext + 2: meta.mapping.key.restructuredtext + 3: punctuation.definition.generic.begin.restructuredtext + 4: entity.name.other.key.restructuredtext + 5: punctuation.definition.generic.end.restructuredtext + 6: + meta.mapping.restructuredtext + meta.separator.key-value.restructuredtext + 7: + meta.mapping.value.restructuredtext + meta.string.restructuredtext + string.unquoted.restructuredtext + constant.language.directive-option-value.restructuredtext + - match: |- + (?x) + {{three_spaces_indentation}} + ( + ((:)(format)(:)) + ([ ]) + (?: + ( + html | html4 | html5 + | latex | xelatex + | odt + | xml | pseudoxml + | manpage + | pep_html + | s5 + ) + | (.*) + ) + ) + $\n? + captures: + 1: + meta.directive.option.restructuredtext + meta.field-list.item.restructuredtext + 2: meta.mapping.key.restructuredtext + 3: punctuation.definition.generic.begin.restructuredtext + 4: entity.name.other.key.restructuredtext + 5: punctuation.definition.generic.end.restructuredtext + 6: + meta.mapping.restructuredtext + meta.separator.key-value.restructuredtext + 7: + meta.mapping.value.restructuredtext + meta.string.restructuredtext + string.unquoted.restructuredtext + constant.language.directive-option-value.restructuredtext + 8: + meta.mapping.value.restructuredtext + meta.string.restructuredtext + string.unquoted.restructuredtext + invalid.illegal.directive-option-value.restructuredtext + - match: |- + (?x) + {{three_spaces_indentation}} + ( + ((:)(parser)(:)) + ([ ]) + (?:(rst|xml) | (.*)) + ) + $\n? + captures: + 1: + meta.directive.option.restructuredtext + meta.field-list.item.restructuredtext + 2: meta.mapping.key.restructuredtext + 3: punctuation.definition.generic.begin.restructuredtext + 4: entity.name.other.key.restructuredtext + 5: punctuation.definition.generic.end.restructuredtext + 6: + meta.mapping.restructuredtext + meta.separator.key-value.restructuredtext + 7: + meta.mapping.value.restructuredtext + meta.string.restructuredtext + string.unquoted.restructuredtext + constant.language.directive-option-value.restructuredtext + 8: + meta.mapping.value.restructuredtext + meta.string.restructuredtext + string.unquoted.restructuredtext + invalid.illegal.directive-option-value.restructuredtext + - match: |- # constant or numerical value + (?x) + {{three_spaces_indentation}} + ( + ((:)(figwidth)(:)) + ([ ]) + (?:(\"image\") | ((\d{1,4})[ ]?(px|%?)) | (.*) ) + ) + $\n? + captures: + 1: + meta.directive.option.restructuredtext + meta.field-list.item.restructuredtext + 2: meta.mapping.key.restructuredtext + 3: punctuation.definition.generic.begin.restructuredtext + 4: entity.name.other.key.restructuredtext + 5: punctuation.definition.generic.end.restructuredtext + 6: + meta.mapping.restructuredtext + meta.separator.key-value.restructuredtext + 7: + meta.mapping.value.restructuredtext + meta.string.restructuredtext + string.quoted.double.restructuredtext + constant.language.directive-option-value.restructuredtext + 8: meta.mapping.value.restructuredtext + 9: + meta.number.integer.decimal.restructuredtext + constant.numeric.value.restructuredtext + 10: storage.type.restructuredtext + 11: invalid.illegal.expected-newline.restructuredtext + - match: |- + (?x) + {{three_spaces_indentation}} + ( + ((:)(height | width)(:)) + ([ ]) + ((\d{1,4})[ ]?(px|%?)) + ) + $\n? + captures: + 1: + meta.directive.option.restructuredtext + meta.field-list.item.restructuredtext + 2: meta.mapping.key.restructuredtext + 3: punctuation.definition.generic.begin.restructuredtext + 4: entity.name.other.key.restructuredtext + 5: punctuation.definition.generic.end.restructuredtext + 6: + meta.mapping.restructuredtext + meta.separator.key-value.restructuredtext + 7: meta.mapping.value.restructuredtext + 8: + meta.number.integer.decimal.restructuredtext + constant.numeric.value.restructuredtext + 9: storage.type.restructuredtext + - match: |- + (?x) + {{three_spaces_indentation}} + ( + ((:)(loading)(:)) + ([ ]) + (?:(embed|link|lazy) | (.*)) + ) + $\n? + captures: + 1: + meta.directive.option.restructuredtext + meta.field-list.item.restructuredtext + 2: meta.mapping.key.restructuredtext + 3: punctuation.definition.generic.begin.restructuredtext + 4: entity.name.other.key.restructuredtext + 5: punctuation.definition.generic.end.restructuredtext + 6: + meta.mapping.restructuredtext + meta.separator.key-value.restructuredtext + 7: + meta.mapping.value.restructuredtext + meta.string.restructuredtext + string.unquoted.restructuredtext + constant.language.directive-option-value.restructuredtext + 8: + meta.mapping.value.restructuredtext + meta.string.restructuredtext + string.unquoted.restructuredtext + invalid.illegal.directive-option-value.restructuredtext + - match: |- + (?x) + {{three_spaces_indentation}} + ( + ((:)(scale)(:)) + ([ ]) + ((\d{1,3})[ ]?(%)?) + ) + $\n? + captures: + 1: + meta.directive.option.restructuredtext + meta.field-list.item.restructuredtext + 2: meta.mapping.key.restructuredtext + 3: punctuation.definition.generic.begin.restructuredtext + 4: entity.name.other.key.restructuredtext + 5: punctuation.definition.generic.end.restructuredtext + 6: + meta.mapping.restructuredtext + meta.separator.key-value.restructuredtext + 7: meta.mapping.value.restructuredtext + 8: + meta.number.integer.decimal.restructuredtext + constant.numeric.value.restructuredtext + 9: storage.type.restructuredtext + - match: |- + (?x) + {{three_spaces_indentation}} + ( + ((:)(widths)(:)) + ([ ]) + (auto|grid|(?:\d+(?:[ ,]\d+)*)) + ) + $\n? + captures: + 1: + meta.directive.option.restructuredtext + meta.field-list.item.restructuredtext + 2: meta.mapping.key.restructuredtext + 3: punctuation.definition.generic.begin.restructuredtext + 4: entity.name.other.key.restructuredtext + 5: punctuation.definition.generic.end.restructuredtext + 6: + meta.mapping.restructuredtext + meta.separator.key-value.restructuredtext + 7: + meta.mapping.value.restructuredtext + meta.string.restructuredtext + string.unquoted.restructuredtext + + raw-code-directives: + - match: |- + (?x) + ^ + ([[:blank:]]*) + ( + ( {{two_dots}} ) + [[:blank:]]+ + (?: code-block | code | raw ) + (::) + [[:blank:]]+ + ( plain | text ) + $\n? + ) + captures: + 2: meta.directive.raw-code.restructuredtext 3: punctuation.definition.directive.restructuredtext 4: punctuation.separator.key-value.restructuredtext - push: - - match: '^(?!\1\s+)(?=\s*\S+)' - pop: true - - meta_content_scope: text.html.basic - - include: scope:text.html.basic - - match: '^(\s*)((\.\.)\s+[A-z][A-z0-9\-_]+(::))\s*' - comment: directives + 5: + meta.fold.raw-code-directive.begin.restructuredtext + constant.other.language-name.restructuredtext + push: raw-text-directive-body + - match: |- + (?x) + ^ + ([[:blank:]]*) + ( + ( {{two_dots}} ) + [[:blank:]]+ + (?: code-block | code | raw ) + (::) + [[:blank:]]+ + ( css ) + $\n? + ) captures: - 2: meta.other.directive.restructuredtext + 2: meta.directive.raw-code.restructuredtext 3: punctuation.definition.directive.restructuredtext 4: punctuation.separator.key-value.restructuredtext - push: - - match: '^(?!\1\s+)(?=\s*\S+)' - pop: true - - include: inline - - match: '^(\s*).*?((::))' - comment: verbatim blocks - captures: - 2: markup.raw.restructuredtext - 3: punctuation.definition.raw.restructuredtext - push: - - meta_scope: meta.raw.block.restructuredtext - - match: '^(?!\1\s+)(?=\s*\S+)' - pop: true - - match: .+ - scope: markup.raw.restructuredtext - - match: "::" - comment: directives - scope: meta.startraw.restructuredtext - - match: '(\*\*)[^*]+(\*\*)' - comment: strong emphasis - scope: markup.bold.restructuredtext + 5: + meta.fold.raw-code-directive.begin.restructuredtext + constant.other.language-name.restructuredtext + push: raw-css-directive-body + - match: |- + (?x) + ^ + ([[:blank:]]*) + ( + ({{two_dots}}) + [[:blank:]]+ + (?: code-block | code | raw ) + (::) + [[:blank:]]+ + ( html ) + $\n? + ) captures: - 1: punctuation.definition.italic.restructuredtext - 2: punctuation.definition.italic.restructuredtext - - match: '(\*)\w[^*]+\w(\*)' - comment: emphasis - scope: markup.italic.restructuredtext + 2: meta.directive.raw-code.restructuredtext + 3: punctuation.definition.directive.restructuredtext + 4: punctuation.separator.key-value.restructuredtext + 5: + meta.fold.raw-code-directive.begin.restructuredtext + constant.other.language-name.restructuredtext + push: raw-html-directive-body + - match: |- + (?x) + ^ + ([[:blank:]]*) + ( + ({{two_dots}}) + [[:blank:]]+ + (?: code-block | code | raw ) + (::) + [[:blank:]]+ + ( javascript | js ) + $\n? + ) captures: - 1: punctuation.definition.italic.restructuredtext - 2: punctuation.definition.italic.restructuredtext - - match: '(\.\.)\s+(_)([\w\s]+)(:)\s+(.*)' - comment: replacement - scope: meta.link.reference.def.restructuredtext + 2: meta.directive.raw-code.restructuredtext + 3: punctuation.definition.directive.restructuredtext + 4: punctuation.separator.key-value.restructuredtext + 5: + meta.fold.raw-code-directive.begin.restructuredtext + constant.other.language-name.restructuredtext + push: raw-javascript-directive-body + - match: |- + (?x) + ^ + ([[:blank:]]*) + ( + ({{two_dots}}) + [[:blank:]]+ + (?: code-block | code | raw ) + (::) + [[:blank:]]+ + ( jsonc? ) + $\n? + ) captures: - 1: punctuation.definition.link.restructuredtext - 2: punctuation.definition.string.restructuredtext - 3: string.other.link.title.restructuredtext + 2: meta.directive.raw-code.restructuredtext + 3: punctuation.definition.directive.restructuredtext 4: punctuation.separator.key-value.restructuredtext - 5: markup.underline.link.restructuredtext - - match: '(\|)[^|]+(\|_{0,2})' - comment: substitution - scope: markup.underline.substitution.restructuredtext + 5: + meta.fold.raw-code-directive.begin.restructuredtext + constant.other.language-name.restructuredtext + push: raw-json-directive-body + - match: |- + (?x) + ^ + ([[:blank:]]*) + ( + ({{two_dots}}) + [[:blank:]]+ + (?: code-block | code | raw ) + (::) + [[:blank:]]+ + ( python | py ) + $\n? + ) captures: - 1: punctuation.definition.substitution.restructuredtext - - match: \b(\w+)(_)\b - comment: links `...`_ or `...`__ - scope: meta.link.reference + 2: meta.directive.raw-code.restructuredtext + 3: punctuation.definition.directive.restructuredtext + 4: punctuation.separator.key-value.restructuredtext + 5: + meta.fold.raw-code-directive.begin.restructuredtext + constant.other.language-name.restructuredtext + push: raw-python-directive-body + - match: |- + (?x) + ^ + ([[:blank:]]*) + ( + ({{two_dots}}) + [[:blank:]]+ + (?: code-block | code | raw ) + (::) + [[:blank:]]+ + ( toml ) + $\n? + ) captures: - 1: string.other.link.title.restructuredtext - 2: punctuation.definition.link.restructuredtext - - match: '(`)([\w\s]+)(`_)' - comment: links `...`_ or `...`__ - scope: meta.link.reference + 2: meta.directive.raw-code.restructuredtext + 3: punctuation.definition.directive.restructuredtext + 4: punctuation.separator.key-value.restructuredtext + 5: + meta.fold.raw-code-directive.begin.restructuredtext + constant.other.language-name.restructuredtext + push: raw-toml-directive-body + - match: |- + (?x) + ^ + ([[:blank:]]*) + ( + ({{two_dots}}) + [[:blank:]]+ + (?: code-block | code | raw ) + (::) + [[:blank:]]+ + ( yaml | yml ) + $\n? + ) captures: - 1: punctuation.definition.link.restructuredtext - 2: string.other.link.title.restructuredtext - 3: punctuation.definition.link.restructuredtext - - match: '(`)([\w\s]+)\s+(<)(.*?)(>)(`_)' - comment: links `...`_ - scope: meta.link.inline.restructuredtext + 2: meta.directive.raw-code.restructuredtext + 3: punctuation.definition.directive.restructuredtext + 4: punctuation.separator.key-value.restructuredtext + 5: + meta.fold.raw-code-directive.begin.restructuredtext + constant.other.language-name.restructuredtext + push: raw-yaml-directive-body + + raw-text-directive-body: + - include: directive-options-field-list + - match: '^' + embed: scope:text.plain + embed_scope: + meta.directive.raw-code.restructuredtext + text.restructuredtext.embedded.text + text.plain.embedded.restructuredtext + escape: '{{less_or_same_indentation_ahead}}|^(?=\.\.)' + escape_captures: + 0: meta.fold.raw-code-directive.end.restructuredtext + pop: 1 + + raw-css-directive-body: + - include: directive-options-field-list + - match: '^' + embed: scope:source.css + embed_scope: + meta.directive.raw-code.restructuredtext + text.restructuredtext.embedded.css + source.css.embedded.restructuredtext + escape: '{{less_or_same_indentation_ahead}}|^(?=\.\.)' + escape_captures: + 0: meta.fold.raw-code-directive.end.restructuredtext + pop: 1 + + raw-html-directive-body: + - include: directive-options-field-list + - match: '^' + embed: scope:text.html.basic + embed_scope: + meta.directive.raw-code.restructuredtext + text.restructuredtext.embedded.html + text.html.basic.embedded.restructuredtext + escape: '{{less_or_same_indentation_ahead}}|^(?=\.\.)' + escape_captures: + 0: meta.fold.raw-code-directive.end.restructuredtext + pop: 1 + + raw-javascript-directive-body: + - include: directive-options-field-list + - match: '^' + embed: scope:source.js + embed_scope: + meta.directive.raw-code.restructuredtext + text.restructuredtext.embedded.javascript + source.javascript.embedded.restructuredtext + escape: '{{less_or_same_indentation_ahead}}|^(?=\.\.)' + escape_captures: + 0: meta.fold.raw-code-directive.end.restructuredtext + pop: 1 + + raw-json-directive-body: + - include: directive-options-field-list + - match: '^' + embed: scope:source.json + embed_scope: + meta.directive.raw-code.restructuredtext + text.restructuredtext.embedded.json + source.json.embedded.restructuredtext + escape: '{{less_or_same_indentation_ahead}}|^(?=\.\.)' + escape_captures: + 0: meta.fold.raw-code-directive.end.restructuredtext + pop: 1 + + raw-python-directive-body: + - include: directive-options-field-list + - match: '^' + embed: scope:source.python + embed_scope: + meta.directive.raw-code.restructuredtext + text.restructuredtext.embedded.python + source.python.embedded.restructuredtext + escape: '{{less_or_same_indentation_ahead}}|^(?=\.\.)' + escape_captures: + 0: meta.fold.raw-code-directive.end.restructuredtext + pop: 1 + + raw-toml-directive-body: + - include: directive-options-field-list + - match: '^' + embed: scope:source.toml + embed_scope: + meta.directive.raw-code.restructuredtext + text.restructuredtext.embedded.toml + source.toml.embedded.restructuredtext + escape: '{{less_or_same_indentation_ahead}}|^(?=\.\.)' + escape_captures: + 0: meta.fold.raw-code-directive.end.restructuredtext + pop: 1 + + raw-yaml-directive-body: + - include: directive-options-field-list + - match: '^' + embed: scope:source.yaml + embed_scope: + meta.directive.raw-code.restructuredtext + text.restructuredtext.embedded.yaml + source.yaml.embedded.restructuredtext + escape: '{{less_or_same_indentation_ahead}}|^(?=\.\.)' + escape_captures: + 0: meta.fold.raw-code-directive.end.restructuredtext + pop: 1 + + other-directives: + - match: |- + (?x) + ^ + ([[:blank:]]*) + ( + ({{two_dots}}) [[:blank:]]+ + (?: ( {{directive_rest}} ) | ( {{directive_other}} ) ) + (::) + [[:blank:]]* + ) captures: - 1: punctuation.definition.link.restructuredtext + 2: meta.other.directive.restructuredtext + 3: punctuation.definition.directive.restructuredtext + 4: constant.language.directive-name.restructuredtext + 5: constant.other.directive-name.restructuredtext + 6: punctuation.separator.key-value.restructuredtext + push: other-directive-body + + other-directive-body: + - meta_content_scope: meta.other.directive.restructuredtext + - match: '{{less_or_same_indentation_ahead}}' + pop: 1 + - include: explicit-markup-block-pop + - include: body-elements + - include: directive-options-field-list + - include: inline-markup + + substitution-definitions: + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#substitution-definitions + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#inline-compatible-directive + + - match: |- + (?x) + ^ + ([[:blank:]]*) + ( + ({{two_dots}}) [[:blank:]]+ + (\|) + (\b[^\|]+\b) + (\|) + [[:blank:]]+ + ( + (image|replace|unicode|date) + (::) + [[:blank:]]+ + )? + ) + captures: + 2: markup.info.substitution-definition.restructuredtext + 3: punctuation.definition.substitution-definition.restructuredtext + 4: punctuation.definition.substitution.begin.restructuredtext + 5: markup.deleted.restructuredtext + 6: punctuation.definition.substitution.end.restructuredtext + 7: markup.inserted.restructuredtext + 8: meta.generic.inline-compatible-directive.restructuredtext + 9: punctuation.definition.directive.restructuredtext + push: substitution-definition-body + + substitution-definition-body: + - meta_content_scope: + markup.info.substitution-definition.restructuredtext + markup.inserted.restructuredtext + - match: '{{less_or_same_indentation_ahead}}' + pop: 1 + - include: explicit-markup-block-pop + - include: body-elements + - include: directive-options-field-list + - include: inline-markup + + comments: + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#comments + + # NOTE: - Comments are not part of prototype, but regular explicit markup + # blocks, i.e. body elements. + # - Including <- and ^ and @ in the look-ahead for highlighting of + # sublime-syntax test files. + + - match: '^([[:blank:]]*)({{two_dots}})(?=\s|<-|\^|@)' + captures: + 2: punctuation.definition.comment.restructuredtext + push: comment-body + + comment-body: + - meta_scope: comment.block.double-dot.restructuredtext + - match: '{{less_or_same_indentation_ahead}}' + pop: 1 + - include: explicit-markup-block-pop + +###[ BODY ELEMENTS / LISTS ]################################################### + + lists: + - include: bullet-lists + - include: enumerated-lists + - include: definition-lists + - include: field-lists + - include: option-lists + + bullet-lists: + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#bullet-lists + + - match: '^([[:blank:]]*)({{bullet_mark}})[ ]' + captures: + 2: + markup.list.unnumbered.bullet.restructuredtext + punctuation.definition.list_item.restructuredtext + push: bullet-list-body + + bullet-list-body: + - meta_scope: markup.list.unnumbered.restructuredtext + - match: '{{less_or_same_indentation_ahead}}' + pop: 1 + - include: explicit-markup-block-pop + - include: inline-markup + + enumerated-lists: + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#enumerated-lists + + - match: '^([[:blank:]]*)(?!\\)({{enumerated_bullet_mark}})(?!\\)[ ]' + captures: + 2: + markup.list.numbered.bullet.restructuredtext + punctuation.definition.list_item.restructuredtext + push: enumerated-list-body + + enumerated-list-body: + - meta_scope: markup.list.numbered.restructuredtext + - match: '{{less_or_same_indentation_ahead}}' + pop: 1 + - include: explicit-markup-block-pop + - include: inline-markup + + definition-lists: [] + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#definition-lists + + # - match: '^\S+(?:[ ](:)[ ][^:]+)*' + # captures: + # 1: punctuation.definition.generic.restructuredtext + # push: definition-list-body + + definition-list-body: [] + # - meta_scope: markup.list.definition.restructuredtext + # - match: '^(?![[:blank:]]+)(?=[[:blank:]]*\S+)' + # pop: 1 + + # TODO: no blank line between term and definition + # TODO: beware of escapes at beginning of term + + # - include: explicit-markup-block-pop + + field-lists: + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#field-lists + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#bibliographic-fields + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#rcs-keywords + + # TODO: include inline markup parsed in field names, interpreted text must + # have role as suffix + + - match: '^((:)({{bibliographic_field}})(:))([ ])' + captures: + 1: meta.mapping.key.restructuredtext + 2: punctuation.definition.generic.begin.restructuredtext + 3: entity.name.tag.restructuredtext + 4: punctuation.definition.generic.end.restructuredtext + 5: + meta.mapping.restructuredtext + meta.separator.key-value.restructuredtext + push: field-list-body + + field-list-body: + - meta_scope: meta.field-list.item.restructuredtext + - meta_content_scope: meta.mapping.value.restructuredtext + - match: '^(?![[:blank:]]+)(?=[[:blank:]]*\S+)' + pop: 1 + - include: explicit-markup-block-pop + + option-lists: [] + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#option-lists + + # - match: 'option-list' + # scope: '' + # push: option-list-body + + option-list-body: [] + # - meta_scope: markup.list.option.restructuredtext + # - match: 'option-list' + # pop: 1 + # - include: explicit-markup-block-pop + +###[ INLINE MARKUP ]########################################################### + + inline-markup: + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#inline-markup + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#recognition-order + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#character-level-inline-markup + + - include: inline-text-styles + - include: inline-literals + - include: inline-internal-targets + - include: inline-hyperlink-references + - include: inline-interpreted-text + - include: inline-footnote-references + - include: inline-substitution-references + - include: inline-standalone-links + - include: inline-replacements + - include: inline-citation-references + + inline-text-styles: + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#strong-emphasis + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#emphasis + + - match: |- + (?x: + ({{bold_begin}}) + [^*]+ + ({{bold_end}}) + ) + scope: markup.bold.restructuredtext + captures: + 1: punctuation.definition.bold.begin.restructuredtext + 2: punctuation.definition.bold.end.restructuredtext + - match: |- + (?x: + ({{italic_begin}}) + [^*]+ + ({{italic_end}}) + ) + scope: markup.italic.restructuredtext + captures: + 1: punctuation.definition.italic.begin.restructuredtext + 2: punctuation.definition.italic.end.restructuredtext + + inline-literals: + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#inline-literals + + - match: '(``)`(``)(?!`)' + scope: markup.raw.inline.restructuredtext + captures: + 1: punctuation.definition.raw.begin.restructuredtext + 2: punctuation.definition.raw.end.restructuredtext + - match: '{{literals_begin}}' + scope: punctuation.definition.raw.begin.restructuredtext + push: inline-literal-body + + inline-literal-body: + # NOTE: May span lines, hence no pop on linebreak. Empty lines are + # forbidden, though. + - meta_include_prototype: false + - meta_scope: markup.raw.inline.restructuredtext + - match: '{{literals_end}}' + scope: punctuation.definition.raw.end.restructuredtext + pop: 1 + - match: ^$\n + scope: invalid.illegal.emptyline.restructuredtext + + inline-internal-targets: + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#inline-internal-targets + + - match: '_`' + scope: punctuation.definition.generic.begin.restructuredtext + push: inline-internal-target-body + + inline-internal-target-body: + - meta_include_prototype: false + - meta_scope: markup.underline.link.restructuredtext + - match: '`' + scope: punctuation.definition.generic.end.restructuredtext + pop: 1 + - match: $\n? + scope: invalid.illegal.newline.restructuredtext + pop: 1 + + inline-hyperlink-references: + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#hyperlink-references + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#embedded-uris-and-aliases + + # `word word `__ + - match: '(`)([A-Za-z][A-Za-z''\(\)\.[:blank:]]*)[[:blank:]]+(<)([^>]*?)(>)(`_{1,2})' + scope: + meta.link.inline.restructuredtext + captures: + 1: punctuation.definition.link.begin.restructuredtext 2: string.other.link.title.restructuredtext - 3: punctuation.definition.location.restructuredtext + 3: punctuation.definition.location.begin.restructuredtext 4: markup.underline.link.restructuredtext - 5: punctuation.definition.location.restructuredtext - 6: punctuation.definition.link.restructuredtext - - match: '^(\.\.)\s+((\[)(((#?)[^]]*?)|\*)(\]))\s+(.*)' - comment: replacement - scope: meta.link.footnote.def.restructuredtext + 5: punctuation.definition.location.end.restructuredtext + 6: punctuation.definition.link.end.restructuredtext + # `word word`__ + - match: '(`)([A-Za-z][A-Za-z''\(\)\.[:blank:]]*)(`_{1,2})' + scope: + meta.link.reference.restructuredtext + string.other.link.title.restructuredtext + captures: + 1: punctuation.definition.link.begin.restructuredtext + 3: punctuation.definition.link.end.restructuredtext + # word_ + - match: '\b[A-Za-z][A-Za-z'']*(_{1,2})\b' + scope: + meta.link.reference.restructuredtext + string.other.link.title.restructuredtext captures: 1: punctuation.definition.link.restructuredtext - 2: constant.other.footnote.link.restructuredtext - 3: punctuation.definition.constant.restructuredtext - 6: punctuation.definition.constant.restructuredtext - 7: punctuation.definition.constant.restructuredtext - 8: string.other.footnote.restructuredtext - - match: '((\[)[0-9]+(\]))(_)' - comment: "footnote reference: [0]_" + + inline-interpreted-text: + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#interpreted-text + + - match: |- + (?x) + (:{{interpreted_text_roles}}:) + ({{interpreted_text_begin}}) + [^{{interpreted_text_mark}}]+ + ({{interpreted_text_end}}) + (?!_) + scope: markup.other.restructuredtext + captures: + 1: storage.type.restructuredtext + 2: punctuation.definition.markup-interpreted.begin.restructuredtext + 3: punctuation.definition.markup-interpreted.end.restructuredtext + - match: |- + (?x) + ({{interpreted_text_begin}}) + [^{{interpreted_text_mark}}]+ + ({{interpreted_text_end}}) + (?!_) + (:{{interpreted_text_roles}}:) + scope: markup.other.restructuredtext + captures: + 1: punctuation.definition.markup-interpreted.begin.restructuredtext + 2: punctuation.definition.markup-interpreted.end.restructuredtext + 3: storage.type.restructuredtext + - match: |- + (?x) + ({{interpreted_text_begin}}) + [^{{interpreted_text_mark}}]+ + ({{interpreted_text_end}}) + (?!_) + scope: markup.other.restructuredtext + captures: + 1: punctuation.definition.markup-interpreted.begin.restructuredtext + 2: punctuation.definition.markup-interpreted.end.restructuredtext + + inline-footnote-references: + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#footnote-references + + - match: '(\[)(\d+)(\]_)' # "footnote reference: [0]_" scope: meta.link.footnote.numeric.restructuredtext captures: - 1: constant.other.footnote.link - 2: punctuation.definition.constant.restructuredtext - 3: punctuation.definition.constant.restructuredtext - 4: punctuation.definition.constant.restructuredtext - - match: '((\[#)[A-z0-9_]*(\]))(_)' - comment: "footnote reference [#]_ or [#foo]_" + 1: punctuation.definition.footnote-reference.begin.restructuredtext + 2: constant.other.footnote.link.restructuredtext + 3: punctuation.definition.footnote-reference.end.restructuredtext + - match: '(\[#)([[:alnum:]_]*)(\]_)' # "footnote reference [#]_ or [#foo]_" scope: meta.link.footnote.auto.restructuredtext captures: - 1: constant.other.footnote.link - 2: punctuation.definition.constant.restructuredtext - 3: punctuation.definition.constant.restructuredtext - 4: punctuation.definition.constant.restructuredtext - - match: '((\[)\*(\]))(_)' - comment: "footnote reference [*]_" + 1: punctuation.definition.footnote-reference.begin.restructuredtext + 2: constant.other.footnote.link.restructuredtext + 3: punctuation.definition.footnote-reference.end.restructuredtext + - match: '(\[)({{footnote_mark}})(\]_)' # "footnote reference [*]_" scope: meta.link.footnote.symbol.auto.restructuredtext captures: - 1: constant.other.footnote.link.restructuredtext - 2: punctuation.definition.constant.restructuredtext - 3: punctuation.definition.constant.restructuredtext - 4: punctuation.definition.constant.restructuredtext - - match: '^(\.\.)\s+((\[)[A-z][A-z0-9]*(\]))(_)\s+(.*)' - comment: replacement - scope: meta.link.citation.def.restructuredtext + 1: punctuation.definition.footnote-reference.begin.restructuredtext + 2: constant.other.footnote.link.restructuredtext + 3: punctuation.definition.footnote-reference.end.restructuredtext + + inline-substitution-references: + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#substitution-references + + # TODO: scope for trailing underline? + + - match: '(\|)[^|]+(\|_{0,2})' + scope: markup.underline.substitution.restructuredtext + captures: + 1: punctuation.definition.substitution.begin.restructuredtext + 2: punctuation.definition.substitution.end.restructuredtext + + inline-standalone-links: [] + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#standalone-hyperlinks + + # TODO: ... + + inline-replacements: + - match: '({{two_dots}})[[:blank:]]+(_)([\w\-\.:\+]+)(:)[[:blank:]]+(.*)' + scope: meta.link.reference.def.restructuredtext captures: 1: punctuation.definition.link.restructuredtext - 2: constant.other.citation.link.restructuredtext - 3: punctuation.definition.constant.restructuredtext - 4: punctuation.definition.constant.restructuredtext - 5: punctuation.definition.constant.restructuredtext - 6: string.other.citation.restructuredtext - - match: '((\[)[A-z][A-z0-9_-]*(\]))(_)' - comment: citation reference + 2: punctuation.definition.string.restructuredtext + 3: string.other.link.title.restructuredtext + 4: punctuation.separator.key-value.restructuredtext + 5: markup.underline.link.restructuredtext + + inline-citation-references: + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#citation-references + + - match: '((\[)[[:alpha:]][[:alnum:]_-]*(\]))(_)' scope: meta.link.citation.restructuredtext captures: 1: constant.other.citation.link.restructuredtext 2: punctuation.definition.constant.restructuredtext 3: punctuation.definition.constant.restructuredtext 4: punctuation.definition.constant.restructuredtext - - match: "``" - comment: inline literal - captures: - 0: punctuation.definition.raw.restructuredtext - push: - - meta_scope: markup.raw.restructuredtext - - match: "``" - captures: - 0: punctuation.definition.raw.restructuredtext - pop: true - - match: "(`)[^`]+(`)(?!_)" - comment: interpreted text - scope: markup.other.command.restructuredtext - captures: - 1: punctuation.definition.interpreted.restructuredtext - 2: punctuation.definition.interpreted.restructuredtext - - match: '(:)[A-z][A-z0-9 =\s\t_]*(:)' - comment: field list - scope: entity.name.tag.restructuredtext - captures: - 1: punctuation.definition.field.restructuredtext - 2: punctuation.definition.field.restructuredtext - - match: '\+-[+-]+' - comment: table - scope: markup.other.table.restructuredtext - captures: - 0: punctuation.definition.table.restructuredtext - - match: '\+=[+=]+' - comment: table - scope: markup.other.table.restructuredtext - captures: - 0: punctuation.definition.table.restructuredtext - - match: '(^(=|-|~|`|#|"|\^|\+|\*){3,}$){1,1}?' - scope: markup.heading.restructuredtext - captures: - 1: punctuation.definition.heading.restructuredtext - - match: ^(\s*)(\.\.) - comment: comment - captures: - 2: punctuation.definition.comment.restructuredtext - push: - - meta_scope: comment.line.double-dot.restructuredtext - - match: '^(?!\1\s+)(?=\s*\S+)' - pop: true - - include: merge-conflict-markers -###[ MERGE CONFLICT MARKERS ]################################################## +###[ PROTOTYPES ]############################################################## - merge-conflict-markers: - # see also: Diff.sublime-syntax#conflict-markers - - match: ^(<{7})(?:\s+(\S.*?))?$\n? - scope: meta.block.conflict.begin.diff - captures: - 1: punctuation.section.block.begin.diff - 2: entity.name.section.diff - - match: ^(>{7})(?:\s+(\S.*?))?$\n? - scope: meta.block.conflict.end.diff - captures: - 1: punctuation.section.block.end.diff - 2: entity.name.section.diff - - match: ^(\|{7}|={7})(?:\s+(\S.*?))?$\n? - scope: meta.block.conflict.separator.diff - captures: - 1: punctuation.section.block.diff - 2: entity.name.section.diff + # else-pop: + # - match: (?=\S) + # pop: 1 + + empty-line-pop: + - match: $ + branch_point: empty-line-pop + branch: + - check-empty-next-line + - immediately-pop2 + + check-empty-next-line: + - match: '(?=^{{end_of_line}})' + fail: empty-line-pop + - match: ^ + pop: 1 + + # eol-pop: + # - match: $ + # pop: 1 + + explicit-markup-block-pop: + - match: $ + branch_point: explicit-markup-block-pop + branch: + - check-explicit-markup-block-next-line + - immediately-pop2 + + check-explicit-markup-block-next-line: + - match: '(?=^\s*\.\.)' + fail: explicit-markup-block-pop + - match: ^ + pop: 1 + + immediately-pop: + - meta_include_prototype: false + - match: '' + pop: 1 + + immediately-pop2: + - meta_include_prototype: false + - match: '' + pop: 2 + +###[ VARIABLES ]############################################################### + +variables: + line_break: (?:\n) + end_of_line: (?:${{line_break}}?) + + two_dots: (?:\.{2}) + + less_or_same_indentation_ahead: '^(?!\1[[:blank:]]+)(?=[[:blank:]]*\S)' + three_spaces_indentation: '^(?:[ ]{3})' + + directive_other: (?:[[:alpha:]][[:alnum:]\-_]+) + # https://docutils.sourceforge.io/docs/ref/rst/directives.html + directive_rest_admonition: |- + (?xi: + attention + | caution + | danger + | error + | hint + | important + | note + | tip + | warning + | admonition + ) + directive_rest_image: |- + (?xi: + image + | figure + ) + directive_rest_body_element: |- + (?xi: + # NOTE: `code-block`, `code` should be in this list, but are handled + # separately to correctly highlight code blocks + topic + | sidebar + | line-block + | parsed-literal + | math + | rubric + | epigraph + | highlights + | pull-quote + | compound + | container + ) + directive_rest_table: |- + (?xi: + table + | csv-table + | list-table + ) + directive_rest_document_part: |- + (?xi: + contents + | sectnum | section-numbering + | header | footer + ) + directive_rest_reference: |- + (?xi: + target-notes + ) + directive_rest_substitution_defition: |- + (?xi: + replace + | unicode + | date + ) + directive_rest_miscellaneous: |- + (?xi: + # NOTE: `raw` should be in this list, but is handled separately to + # correctly highlight code blocks + include + | class + | role | default-role + | meta + | title + | restructuredtext-test-directive + ) + directive_rest: |- + (?xi: + {{directive_rest_admonition}} + | {{directive_rest_image}} + | {{directive_rest_body_element}} + | {{directive_rest_table}} + | {{directive_rest_document_part}} + | {{directive_rest_reference}} + | {{directive_rest_substitution_defition}} + | {{directive_rest_miscellaneous}} + ) + + unescaped_backslash: (?:[^\\][\\]) + + section_title_adornment_or_transition_mark: (?:=|-|`|:|\.|'|"|~|\^|_|\*|\+|\#) + + maybe_section_heading_ahead: |- + (?x: + (?= + (?:^(?:{{section_title_adornment_or_transition_mark}}{3,})$) + | (?:^$) + | (?:^\S) + ) + ) + + bullet_mark: (?:[-+*\x{2022}\x{2023}\x{2043}]) + roman_numeral: (?i:M{0,4}(?:CM|CD|D?C{0,3})(?:XC|XL|L?X{0,3})(?:IX|IV|V?I{0,3})) + enumerated_any: (?:{{roman_numeral}}|[[:alpha:]]|\d{1,4}) + enumerated_bullet_mark: (?:{{enumerated_any}}\.|\({{enumerated_any}}\)|{{enumerated_any}}\)) + + bold_mark: (?:\*{2}) + bold_begin: (?:(?!{{unescaped_backslash}}){{bold_mark}}\b) + bold_end: (?:\b(?!{{unescaped_backslash}}){{bold_mark}}) + + italic_mark: (?:\*) + italic_begin: (?:(?!{{unescaped_backslash}}){{italic_mark}}\b) + italic_end: (?:\b(?!{{unescaped_backslash}}){{italic_mark}}) + + literals_mark: (?:`{2}) + literals_begin: (?:(?!{{unescaped_backslash}}){{literals_mark}}(?=[^`])) + literals_end: (?:{{literals_mark}}) + + interpreted_text_mark: (?:`) + interpreted_text_begin: (?:(?!{{unescaped_backslash}}){{interpreted_text_mark}}\b) + interpreted_text_end: (?:\b(?!{{unescaped_backslash}}){{interpreted_text_mark}}) + + # https://docutils.sourceforge.io/docs/ref/rst/roles.html + # NOTE: some roles have aliases + interpreted_text_roles: |- + (?x: + abbreviation | ab + | acronym | ac + | code + | emphasis + | literal + | math + | pep-reference | PEP + | rfc-reference | RFC + | strong + | subscript | sub + | superscript | super + | title-reference | title | t + | raw-(?:[a-z]+) | raw + ) + + bibliographic_field: |- + (?x: + Abstract + | Address + | Authors? + | Contact + | Copyright + | Date + | Dedication + | Organization + | Revision + | Status + | Version + ) + + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#auto-symbol-footnotes + footnote_mark: (?:(?:†|‡|§|¶|\#|♠️|♥️|♦️|♣️)+) + + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#length-units + length_unit: |- + (?x: + em # element's font size + | ex # x-height of element's font size + | ch # width of the 0 glyph in the element's font + | rem # font size of the root element + | vw # 1% of the viewport width + | vh # 1% of the viewport height + | vmin # 1% of the viewport's smaller dimension + | vmax # 1% of the viewport's larger dimension + | cm # centimeters + | mm # millimeters + | Q # quarter-millimeters + | in # inches + | pc # picas (= 1/6 inch = 12 pt) + | pt # 1 pt (= 1/72 in) + | px # 1 px (= 3/4 pt = 1/96 in) + ) + # https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#percentage-unit + percentage_unit: |- + (?x: + % # percent sign + ) diff --git a/RestructuredText/src/__init__.py b/RestructuredText/src/__init__.py new file mode 100644 index 0000000000..f2b861e35b --- /dev/null +++ b/RestructuredText/src/__init__.py @@ -0,0 +1,5 @@ +#!/usr/bin/env python3 +# coding: utf-8 + + +from .window_commands import * diff --git a/RestructuredText/src/window_commands.py b/RestructuredText/src/window_commands.py new file mode 100644 index 0000000000..6d762180f2 --- /dev/null +++ b/RestructuredText/src/window_commands.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python3 +# coding: utf-8 + + +from __future__ import annotations # https://docs.python.org/3.13/library/__future__.html + +import sublime # EXECUTABLE_DIR/Lib/python313/sublime.py +import sublime_plugin # EXECUTABLE_DIR/Lib/python313/sublime_plugin.py + +import typing # https://docs.python.org/3.13/library/typing.html + + +PKG_NAME : typing.Final[str] = str(__package__).split('.')[0] + + +def status_msg(msg:str) -> None: + + sublime.status_message(f'{PKG_NAME}: {msg}') + + +class RestructuredtextEncapsulateLiteralCommand(sublime_plugin.TextCommand): + """ + If (conditions applied in keymap): + - we are in a reStructuredText source file, and + - all selections have some text selected + + then wrap the selected text like this: + + ``selected text`` + """ + @typing.override + def run(self, edit:sublime.Edit) -> None: + sel_list : sublime.Selection = self.view.sel() + + # Replace each selection with edited string. + for rgn in reversed(sel_list): + selected_text : str = self.view.substr(rgn) + new_text : str = '``' + selected_text + '``' + self.view.replace(edit, rgn, new_text) + + # De-select each selection, leaving cursor on right edge of its + # previous selection. This avoids the danger of a stray keystroke + # wiping out the new text. + for i, rgn in enumerate(sel_list): + del sel_list[i] + sel_list.add(sublime.Region(rgn.end())) + + status_msg("Made all selections a literal command.") + + +class RestructuredtextEncapsulateInterpretedTextRoleCommand(sublime_plugin.TextCommand): + """ + If (conditions applied in keymap): + - we are in a reStructuredText source file, and + - all selections have some text selected + + then wrap the selected text like this: + + :role_name:`selected text` + """ + @typing.override + def run(self, edit:sublime.Edit, role_name:str) -> None: + sel_list : sublime.Selection = self.view.sel() + + # Replace each selection with edited string. + for rgn in reversed(sel_list): + selected_text : str = self.view.substr(rgn) + new_text : str = f':{role_name}:`{selected_text}`' + self.view.replace(edit, rgn, new_text) + + # De-select each selection, leaving cursor on right edge of its + # previous selection. This avoids the danger of a stray keystroke + # wiping out the new text. + for i, rgn in enumerate(sel_list): + del sel_list[i] + sel_list.add(sublime.Region(rgn.end())) + + status_msg("Made all selections an interpreted text role.") diff --git a/RestructuredText/syntax_test_restructuredtext.rst b/RestructuredText/syntax_test_restructuredtext.rst deleted file mode 100644 index d538832aa3..0000000000 --- a/RestructuredText/syntax_test_restructuredtext.rst +++ /dev/null @@ -1,153 +0,0 @@ -.. SYNTAX TEST "Packages/RestructuredText/reStructuredText.sublime-syntax" - -.. a comment -.. <- punctuation.definition.comment.restructuredtext -.. ^^^^^^^^^ comment.line.double-dot.restructuredtext - - -.. - a multi-line comment is indented after initial .. -..^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.double-dot.restructuredtext - - -.. - a multi-line comment ends at the first character in the - first column -This is not a comment -.. <- meta.paragraph.restructuredtext - -.. multi line comments can contain blank lines. - - These are still part of the comment if they're indented. -.. <- comment.line.double-dot.restructuredtext - - -<<<<<<< HEAD -.. <- meta.block.conflict.begin.diff punctuation.section.block.begin.diff -..^^^^^ meta.block.conflict.begin.diff punctuation.section.block.begin.diff -.. ^ meta.block.conflict.begin.diff - entity - punctuation -.. ^^^^ meta.block.conflict.begin.diff entity.name.section.diff -.. ^ meta.block.conflict.begin.diff - entity - punctuation - ->>>>>>> master -.. <- meta.block.conflict.end.diff punctuation.section.block.end.diff -..^^^^^ meta.block.conflict.end.diff punctuation.section.block.end.diff -.. ^ meta.block.conflict.end.diff - entity - punctuation -.. ^^^^^^ meta.block.conflict.end.diff entity.name.section.diff -.. ^ meta.block.conflict.end.diff - entity - punctuation - - -Some text -.. <- meta.paragraph.restructuredtext - - -Paragraph of text -.. <- meta.paragraph.restructuredtext - -A heading -========= -.. <- meta.paragraph.restructuredtext markup.heading.restructuredtext punctuation.definition.heading.restructuredtext - -A heading ---------- -.. <- meta.paragraph.restructuredtext markup.heading.restructuredtext punctuation.definition.heading.restructuredtext - -A heading -~~~~~~~~~ -.. <- meta.paragraph.restructuredtext markup.heading.restructuredtext punctuation.definition.heading.restructuredtext - -A heading -######### -.. <- meta.paragraph.restructuredtext markup.heading.restructuredtext punctuation.definition.heading.restructuredtext - -A heading -""""""""" -.. <- meta.paragraph.restructuredtext markup.heading.restructuredtext punctuation.definition.heading.restructuredtext - -A heading -^^^^^^^^^ -.. <- meta.paragraph.restructuredtext markup.heading.restructuredtext punctuation.definition.heading.restructuredtext - -A heading -+++++++++ -.. <- meta.paragraph.restructuredtext markup.heading.restructuredtext punctuation.definition.heading.restructuredtext - -A heading -********* -.. <- meta.paragraph.restructuredtext markup.heading.restructuredtext punctuation.definition.heading.restructuredtext - - -This is *italic*. -.. ^^^^^^^^ markup.italic.restructuredtext -.. ^ punctuation.definition.italic.restructuredtext - -this is **bold**. -.. ^^^^^^^^ markup.bold.restructuredtext - - -Directive tests --------------- - -.. note that comments within multiline directives must be indented, else they - convert the contents of that directive into a comment - -.. note:: Single line note -.. <- punctuation.definition.directive.restructuredtext -.. ^^^^ meta.other.directive.restructuredtext -.. ^^ punctuation.separator.key-value.restructuredtext - -.. note:: - .. ^^^^ meta.other.directive.restructuredtext - .. ^^ punctuation.separator.key-value.restructuredtext - - Outer note - - .. note:: Inner single line note - .. <- punctuation.definition.directive.restructuredtext - .. ^^^^ meta.other.directive.restructuredtext - .. ^^ punctuation.separator.key-value.restructuredtext - - -Verbatim tests --------------- - -:: - - Verbatim -.. ^^^^^^^^ meta.raw.block.restructuredtext - -Can start with other text:: - - Verbatim -.. ^^^^^^^^ meta.raw.block.restructuredtext - -.. blank lines should not cause scopes to be left - -:: - - Verbatim - - Also Verbatim -.. ^^^^^^^^^^^^^ meta.raw.block.restructuredtext - -:: - - Verbatim - - Also Verbatim -.. ^^^^^^^^^^^^^ meta.raw.block.restructuredtext - - -:: - - Verbatim - -Not verbatim -.. <- meta.paragraph.restructuredtext - -.. raw:: html - - Blank lines are fine - - -.. ^^^^ text.html.basic \ No newline at end of file diff --git a/RestructuredText/tests/syntax_test_conflicts.rst b/RestructuredText/tests/syntax_test_conflicts.rst new file mode 100644 index 0000000000..8fa15213f0 --- /dev/null +++ b/RestructuredText/tests/syntax_test_conflicts.rst @@ -0,0 +1,50 @@ +.. SYNTAX TEST "Packages/RestructuredText/reStructuredText.sublime-syntax" +.. <- text.restructuredtext + + + +.. MERGE CONFLICT MARKERS ...................................................... + + + +<<<<<<< HEAD +.. <- meta.block.conflict.begin.diff punctuation.section.block.begin.diff + .. <- meta.block.conflict.begin.diff punctuation.section.block.begin.diff +..^^^^^ meta.block.conflict.begin.diff punctuation.section.block.begin.diff +.. ^ meta.block.conflict.begin.diff - entity - punctuation +.. ^^^^ meta.block.conflict.begin.diff entity.name.section.diff +.. @@@@ local-definition "Conflict: HEAD" +.. ^ meta.block.conflict.begin.diff - entity - punctuation + ours +======= +.. <- meta.block.conflict.separator.diff punctuation.section.block.diff + .. <- meta.block.conflict.separator.diff punctuation.section.block.diff +..^^^^^ meta.block.conflict.separator.diff punctuation.section.block.diff +.. ^ meta.block.conflict.separator.diff - punctuation + theirs +======= branchname +.. <- meta.block.conflict.separator.diff punctuation.section.block.diff + .. <- meta.block.conflict.separator.diff punctuation.section.block.diff +..^^^^^ meta.block.conflict.separator.diff punctuation.section.block.diff +.. ^^^^^^^^^^^^ meta.block.conflict.separator.diff - punctuation + theirs +||||||| +.. <- meta.block.conflict.separator.diff punctuation.section.block.diff + .. <- meta.block.conflict.separator.diff punctuation.section.block.diff +..^^^^^ meta.block.conflict.separator.diff punctuation.section.block.diff +.. ^ meta.block.conflict.separator.diff - punctuation + base +||||||| branchname +.. <- meta.block.conflict.separator.diff punctuation.section.block.diff + .. <- meta.block.conflict.separator.diff punctuation.section.block.diff +..^^^^^ meta.block.conflict.separator.diff punctuation.section.block.diff +.. ^^^^^^^^^^^ meta.block.conflict.separator.diff - punctuation + base +>>>>>>> master +.. <- meta.block.conflict.end.diff punctuation.section.block.end.diff + .. <- meta.block.conflict.end.diff punctuation.section.block.end.diff +..^^^^^ meta.block.conflict.end.diff punctuation.section.block.end.diff +.. ^ meta.block.conflict.end.diff - entity - punctuation +.. ^^^^^^ meta.block.conflict.end.diff entity.name.section.diff +.. ^ meta.block.conflict.end.diff - entity - punctuation + after diff --git a/RestructuredText/tests/syntax_test_restructuredtext.rst b/RestructuredText/tests/syntax_test_restructuredtext.rst new file mode 100644 index 0000000000..89368ad63a --- /dev/null +++ b/RestructuredText/tests/syntax_test_restructuredtext.rst @@ -0,0 +1,1428 @@ +.. SYNTAX TEST "Packages/RestructuredText/reStructuredText.sublime-syntax" +.. <- text.restructuredtext + + + +.. BODY ELEMENTS / HEADINGS AND TRANSITIONS ................................... + + + +===== +Title +===== +.. <- meta.paragraph markup.heading punctuation.definition.heading + +-------- +Subtitle +-------- +.. <- meta.paragraph markup.heading punctuation.definition.heading + +A heading +========= +.. <- meta.paragraph markup.heading punctuation.definition.heading + +A heading +--------- +.. <- meta.paragraph markup.heading punctuation.definition.heading + +A heading +~~~~~~~~~ +.. <- meta.paragraph markup.heading punctuation.definition.heading + +A heading +######### +.. <- meta.paragraph markup.heading punctuation.definition.heading + +A heading +""""""""" +.. <- meta.paragraph markup.heading punctuation.definition.heading + +A heading +^^^^^^^^^ +.. <- meta.paragraph markup.heading punctuation.definition.heading + +A heading ++++++++++ +.. <- meta.paragraph markup.heading punctuation.definition.heading + +A heading +********* +.. <- meta.paragraph markup.heading punctuation.definition.heading + +paragraph before section separator + +---- + +paragraph after section separator + + + +.. BODY ELEMENTS / PARAGRAPHS ................................................. + + + +A paragraph with some text. +.. ^ meta.paragraph + +A paragraph with some text, +on two lines. +.. ^ meta.paragraph + + + +.. BODY ELEMENTS / EXPLICIT MARKUP BLOCKS / FOOTNOTES ......................... + + + +.. [1] This is a footnote. +.. ^^^^^^^^^^^^^^^^^^^^^^^ meta.link.footnote.def +.. ^^^ meta.link.footnote.def constant.other.footnote.link +.. ^ meta.link.footnote.def constant.other.footnote.link punctuation.definition.constant.begin +.. ^ meta.link.footnote.def constant.other.footnote.link punctuation.definition.constant.end +.. ^^^^^^^^^^^^^^^^^^^ meta.link.footnote.def meta.string string.other.footnote +.. ^^^^^^^^^^^^^^^^^^^^^^^^ - meta.link.footnote.def meta.link.footnote.def +.. [2] A footnote contains body elements, + consistently indented + by at least 3 spaces. +.. ^^^^^^^^^^^^^^^^^^^^^ meta.link.footnote.def meta.string string.other.footnote +.. [3] This is a footnote. + + + +.. BODY ELEMENTS / EXPLICIT MARKUP BLOCKS / CITATIONS ......................... + + + +.. [CIT001]_ This is a citation. +.. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.citation.def +.. ^^^^^^^^^ meta.link.citation.def constant.other.citation.link +.. ^ meta.link.citation.def constant.other.citation.link punctuation.definition.constant.begin +.. ^^ meta.link.citation.def constant.other.citation.link punctuation.definition.constant.end +.. ^^^^^^^^^^^^^^^^^^^ meta.link.citation.def meta.string string.other.citation +.. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.link.citation.def meta.link.citation.def +.. [CIT002]_ Just like a footnote, + except the label + is textual. + Also consistently indented + by at least 3 spaces. +.. ^^^^^^^^^^^^^^^^^^^^^ meta.link.citation.def meta.string string.other.citation +.. [CIT003]_ This is a citation. + + + +.. BODY ELEMENTS / EXPLICIT MARKUP BLOCKS / EXPLICIT HYPERLINK TARGETS ........ + + + +.. _description text: https://subdomain.domain.tld/root-folder/ +.. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.target +.. ^^^^^^^^^^^^^^^^^ meta.link.target.anchor +.. ^ meta.link.target.anchor punctuation.definition.link-target +.. ^^^^^^^^^^^^^^^^ meta.link.target.anchor meta.link.target.description +.. ^ meta.link.target punctuation.separator.key-value +.. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.target.address meta.string string.other.link-target-block markup.underline.link + +.. _description text: https:// + subdomain.domain.tld/ + root-folder/ +.. ^ meta.link.target.address meta.string string.other.link-target-block markup.underline.link + +.. _description text: + https://subdomain.domain.tld/root-folder/ +.. ^ meta.link.target.address meta.string string.other.link-target-block markup.underline.link + +.. _description text: ../local\ path\ with\ spaces/ +.. ^ meta.link.target.address meta.string string.other.link-target-block markup.underline.link + +.. _description text: underscore\_ +.. ^ meta.link.target.address meta.string string.other.link-target-block markup.underline.link + +.. _`description text`: https://subdomain.domain.tld/root-folder/ +.. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.target +.. ^^^^^^^^^^^^^^^^^ meta.link.target.anchor +.. ^ meta.link.target.anchor punctuation.definition.link-target +.. ^^^^^^^^^^^^^^^^^^ meta.link.target.anchor meta.link.target.description +.. ^ meta.link.target.description punctuation.definition.generic.begin +.. ^^^^^^^^^^^^^^^^ meta.link.target.description markup.raw.inline +.. ^ meta.link.target.description punctuation.definition.generic.end +.. ^ meta.link.target punctuation.separator.key-value +.. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.target.address meta.string string.other.link-target-block markup.underline.link + +.. _`description text`: https:// + subdomain.domain.tld/ + root-folder/ +.. ^ meta.link.target.address meta.string string.other.link-target-block markup.underline.link + +.. _`description text`: + https://subdomain.domain.tld/root-folder/ +.. ^ meta.link.target.address meta.string string.other.link-target-block markup.underline.link + +.. _`description text`: ../local\ path\ with\ spaces/ +.. ^ meta.link.target.address meta.string string.other.link-target-block markup.underline.link + +.. _`description text`: underscore\_ +.. ^ meta.link.target.address meta.string string.other.link-target-block markup.underline.link + +.. __: ../anonymous/explicit/hyperlink/target/ +.. ^ meta.link.target.address meta.string string.other.link-target-block markup.underline.link + +.. __: ../anonymous/ + explicit/ + hyperlink/ + target/ +.. ^ meta.link.target.address meta.string string.other.link-target-block markup.underline.link + +.. __: + anonymous/ + explicit/ + hyperlink/ + target/ +.. ^ meta.link.target.address meta.string string.other.link-target-block markup.underline.link + +.. comment + +__ ../anonymous/explicit/hyperlink/target/ +.. ^ meta.link.target.address meta.string string.other.link-target-block markup.underline.link + +.. comment + +__ ../anonymous/ + explicit/ + hyperlink/ + target/ +.. ^ meta.link.target.address meta.string string.other.link-target-block markup.underline.link + +.. comment + +__ + anonymous/ + explicit/ + hyperlink/ + target/ +.. ^ meta.link.target.address meta.string string.other.link-target-block markup.underline.link + +.. comment + + + +.. BODY ELEMENTS / EXPLICIT MARKUP BLOCKS / RAW-CODE DIRECTIVES ............... + + + +.. raw:: text +.. ^^^^^^^^^^ meta.directive.raw-code +.. ^^^^^^^^^^ - meta.directive.raw-code meta.directive.raw-code + +.. raw:: css + @media (max-width: 50%) { + #page { + color: #000 !important; + } + } +.. ^ meta.directive.raw-code text.restructuredtext.embedded.css source.css.embedded.restructuredtext + +.. code-block:: html + + Blank lines are fine + + +.. ^ meta.directive.raw-code text.restructuredtext.embedded.html text.html.basic.embedded.restructuredtext + +.. code:: html + + Blank lines are fine + + +.. ^ meta.directive.raw-code text.restructuredtext.embedded.html text.html.basic.embedded.restructuredtext + +.. raw:: html + + Blank lines are fine + + +.. ^ meta.directive.raw-code text.restructuredtext.embedded.html text.html.basic.embedded.restructuredtext + +.. raw:: javascript + this.func() +.. ^ meta.directive.raw-code text.restructuredtext.embedded.javascript source.javascript.embedded.restructuredtext + +.. raw:: js + this.func() +.. ^ meta.directive.raw-code text.restructuredtext.embedded.javascript source.javascript.embedded.restructuredtext + +.. raw:: json + { "one": 1, "two": 2 } +.. ^ meta.directive.raw-code text.restructuredtext.embedded.json source.json.embedded.restructuredtext + +.. raw:: jsonc + { "one": 1, /* comment */ "two": 2 } +.. ^ meta.directive.raw-code text.restructuredtext.embedded.json source.json.embedded.restructuredtext + +.. raw:: python + print("blank lines are fine") + + print("Hello, world!") +.. ^ meta.directive.raw-code text.restructuredtext.embedded.python source.python.embedded.restructuredtext + +.. raw:: toml + table = { key = "value" } +.. ^ meta.directive.raw-code text.restructuredtext.embedded.toml source.toml.embedded.restructuredtext + +.. raw:: yaml + one: + two: 'three' +.. ^ meta.directive.raw-code text.restructuredtext.embedded.yaml source.yaml.embedded.restructuredtext + + + +.. BODY ELEMENTS / EXPLICIT MARKUP BLOCKS / OTHER DIRECTIVES .................. + + + +.. directive-option-test:: + :alt: alternative text + .. <- meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + ..^^^^^^^^^^^^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping + ..^^ meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + .. ^ meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.end + .. ^ meta.directive.option meta.field-list.item meta.mapping meta.separator.key-value + .. ^^^^^^^^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping.value + directive-option-test body + +.. directive-option-test:: + :class: one two three + .. <- meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + ..^^^^^^^^^^^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping + ..^^^^ meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + .. ^ meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.end + .. ^ meta.directive.option meta.field-list.item meta.mapping meta.separator.key-value + .. ^^^^^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping.value + directive-option-test body + +.. directive-option-test:: + :code: python + .. <- meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + ..^^^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping + ..^^^ meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + .. ^ meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.end + .. ^ meta.directive.option meta.field-list.item meta.mapping meta.separator.key-value + .. ^^^^^^ meta.directive.option meta.field-list.item meta.mapping.value + directive-option-test body + +.. directive-option-test:: + :end-before: some text + .. <- meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + ..^^^^^^^^^^^^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping + ..^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + .. ^ meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.end + .. ^ meta.directive.option meta.field-list.item meta.mapping meta.separator.key-value + .. ^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping.value + directive-option-test body + +.. directive-option-test:: + :escape: " + .. <- meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + ..^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping + ..^^^^^ meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + .. ^ meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.end + .. ^ meta.directive.option meta.field-list.item meta.mapping meta.separator.key-value + .. ^ meta.directive.option meta.field-list.item meta.mapping.value + directive-option-test body + +.. directive-option-test:: + :figclass: one two three + .. <- meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + ..^^^^^^^^^^^^^^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping + ..^^^^^^^ meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + .. ^ meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.end + .. ^ meta.directive.option meta.field-list.item meta.mapping meta.separator.key-value + .. ^^^^^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping.value + directive-option-test body + +.. directive-option-test:: + :figname: name + .. <- meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + ..^^^^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping + ..^^^^^^ meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + .. ^ meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.end + .. ^ meta.directive.option meta.field-list.item meta.mapping meta.separator.key-value + .. ^^^^ meta.directive.option meta.field-list.item meta.mapping.value + directive-option-test body + +.. directive-option-test:: + :figwidth: "image" + .. <- meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + ..^^^^^^^^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping + ..^^^^^^^ meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + .. ^ meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.end + .. ^ meta.directive.option meta.field-list.item meta.mapping meta.separator.key-value + .. ^^^^^^^ meta.directive.option meta.field-list.item meta.mapping.value + directive-option-test body + +.. directive-option-test:: + :file: /path/to/file + .. <- meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + ..^^^^^^^^^^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping + ..^^^ meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + .. ^ meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.end + .. ^ meta.directive.option meta.field-list.item meta.mapping meta.separator.key-value + .. ^^^^^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping.value + directive-option-test body + +.. directive-option-test:: + :format: html5 + .. <- meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + ..^^^^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping + ..^^^^^ meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + .. ^ meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.end + .. ^ meta.directive.option meta.field-list.item meta.mapping meta.separator.key-value + .. ^^^^^ meta.directive.option meta.field-list.item meta.mapping.value + directive-option-test body + +.. directive-option-test:: + :language: python + .. <- meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + ..^^^^^^^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping + ..^^^^^^^ meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + .. ^ meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.end + .. ^ meta.directive.option meta.field-list.item meta.mapping meta.separator.key-value + .. ^^^^^^ meta.directive.option meta.field-list.item meta.mapping.value + directive-option-test body + +.. directive-option-test:: + :name: name + .. <- meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + ..^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping + ..^^^ meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + .. ^ meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.end + .. ^ meta.directive.option meta.field-list.item meta.mapping meta.separator.key-value + .. ^^^^ meta.directive.option meta.field-list.item meta.mapping.value + directive-option-test body + +.. directive-option-test:: + :parser: rst + .. <- meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + ..^^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping + ..^^^^^ meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + .. ^ meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.end + .. ^ meta.directive.option meta.field-list.item meta.mapping meta.separator.key-value + .. ^^^ meta.directive.option meta.field-list.item meta.mapping.value + directive-option-test body + +.. directive-option-test:: + :prefix: 1.2.3. + .. <- meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + ..^^^^^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping + ..^^^^^ meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + .. ^ meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.end + .. ^ meta.directive.option meta.field-list.item meta.mapping meta.separator.key-value + .. ^^^^^^ meta.directive.option meta.field-list.item meta.mapping.value + directive-option-test body + +.. directive-option-test:: + :quote: " + .. <- meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + ..^^^^^^^ meta.directive.option meta.field-list.item meta.mapping + ..^^^^ meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + .. ^ meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.end + .. ^ meta.directive.option meta.field-list.item meta.mapping meta.separator.key-value + .. ^ meta.directive.option meta.field-list.item meta.mapping.value + directive-option-test body + +.. directive-option-test:: + :start-after: some text + .. <- meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + ..^^^^^^^^^^^^^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping + ..^^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + .. ^ meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.end + .. ^ meta.directive.option meta.field-list.item meta.mapping meta.separator.key-value + .. ^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping.value + directive-option-test body + +.. directive-option-test:: + :subtitle: subtitle + .. <- meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + ..^^^^^^^^^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping + ..^^^^^^^ meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + .. ^ meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.end + .. ^ meta.directive.option meta.field-list.item meta.mapping meta.separator.key-value + .. ^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping.value + directive-option-test body + +.. directive-option-test:: + :suffix: no suffix + .. <- meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + ..^^^^^^^^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping + ..^^^^^ meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + .. ^ meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.end + .. ^ meta.directive.option meta.field-list.item meta.mapping meta.separator.key-value + .. ^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping.value + directive-option-test body + +.. directive-option-test:: + :target: `reference name`_ + .. <- meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + ..^^^^^^^^^^^^^^^^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping + ..^^^^^ meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + .. ^ meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.end + .. ^ meta.directive.option meta.field-list.item meta.mapping meta.separator.key-value + .. ^^^^^^^^^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping.value + directive-option-test body + +.. directive-option-test:: + :url: /path/to/URI/ + .. <- meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + ..^^^^^^^^^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping + ..^^ meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + .. ^ meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.end + .. ^ meta.directive.option meta.field-list.item meta.mapping meta.separator.key-value + .. ^^^^^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping.value + directive-option-test body + +.. directive-option-test:: + :depth: 6 + .. <- meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + ..^^^^^^^ meta.directive.option meta.field-list.item meta.mapping + ..^^^^ meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + .. ^ meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.end + .. ^ meta.directive.option meta.field-list.item meta.mapping meta.separator.key-value + .. ^ meta.directive.option meta.field-list.item meta.mapping.value + directive-option-test body + +.. directive-option-test:: + :end-line: 99 + .. <- meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + ..^^^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping + ..^^^^^^^ meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + .. ^ meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.end + .. ^ meta.directive.option meta.field-list.item meta.mapping meta.separator.key-value + .. ^^ meta.directive.option meta.field-list.item meta.mapping.value + directive-option-test body + +.. directive-option-test:: + :header-rows: 2 + .. <- meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + ..^^^^^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping + ..^^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + .. ^ meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.end + .. ^ meta.directive.option meta.field-list.item meta.mapping meta.separator.key-value + .. ^ meta.directive.option meta.field-list.item meta.mapping.value + directive-option-test body + +.. directive-option-test:: + :number-lines: 5 + .. <- meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + ..^^^^^^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping + ..^^^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + .. ^ meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.end + .. ^ meta.directive.option meta.field-list.item meta.mapping meta.separator.key-value + .. ^ meta.directive.option meta.field-list.item meta.mapping.value + directive-option-test body + +.. directive-option-test:: + :stub-columns: 2 + .. <- meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + ..^^^^^^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping + ..^^^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + .. ^ meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.end + .. ^ meta.directive.option meta.field-list.item meta.mapping meta.separator.key-value + .. ^ meta.directive.option meta.field-list.item meta.mapping.value + directive-option-test body + +.. directive-option-test:: + :start: 2 + .. <- meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + ..^^^^^^^ meta.directive.option meta.field-list.item meta.mapping + ..^^^^ meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + .. ^ meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.end + .. ^ meta.directive.option meta.field-list.item meta.mapping meta.separator.key-value + .. ^ meta.directive.option meta.field-list.item meta.mapping.value + directive-option-test body + +.. directive-option-test:: + :start-line: 2 + .. <- meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + ..^^^^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping + ..^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + .. ^ meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.end + .. ^ meta.directive.option meta.field-list.item meta.mapping meta.separator.key-value + .. ^ meta.directive.option meta.field-list.item meta.mapping.value + directive-option-test body + +.. directive-option-test:: + :tab-width: 2 + .. <- meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + ..^^^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping + ..^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + .. ^ meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.end + .. ^ meta.directive.option meta.field-list.item meta.mapping meta.separator.key-value + .. ^ meta.directive.option meta.field-list.item meta.mapping.value + directive-option-test body + +.. directive-option-test:: + :keepspace: + .. <- meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + ..^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping + ..^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + .. ^ meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.end + directive-option-test body + +.. directive-option-test:: + :literal: + .. <- meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + ..^^^^^^^ meta.directive.option meta.field-list.item meta.mapping + ..^^^^^^ meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + .. ^ meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.end + directive-option-test body + +.. directive-option-test:: + :local: + .. <- meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + ..^^^^^ meta.directive.option meta.field-list.item meta.mapping + ..^^^^ meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + .. ^ meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.end + directive-option-test body + +.. directive-option-test:: + :ltrim: + .. <- meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + ..^^^^^ meta.directive.option meta.field-list.item meta.mapping + ..^^^^ meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + .. ^ meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.end + directive-option-test body + +.. directive-option-test:: + :number-lines: + .. <- meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + ..^^^^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping + ..^^^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + .. ^ meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.end + directive-option-test body + +.. directive-option-test:: + :rtrim: + .. <- meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + ..^^^^^ meta.directive.option meta.field-list.item meta.mapping + ..^^^^ meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + .. ^ meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.end + directive-option-test body + +.. directive-option-test:: + :trim: + .. <- meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + ..^^^^ meta.directive.option meta.field-list.item meta.mapping + ..^^^ meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + .. ^ meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.end + directive-option-test body + +.. directive-option-test:: + :align: top + .. <- meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + ..^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping + ..^^^^ meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + .. ^ meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.end + .. ^ meta.directive.option meta.field-list.item meta.mapping meta.separator.key-value + .. ^^^ meta.directive.option meta.field-list.item meta.mapping.value + directive-option-test body + +.. directive-option-test:: + :backlinks: entry + .. <- meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + ..^^^^^^^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping + ..^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + .. ^ meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.end + .. ^ meta.directive.option meta.field-list.item meta.mapping meta.separator.key-value + .. ^^^^^ meta.directive.option meta.field-list.item meta.mapping.value + directive-option-test body + +.. directive-option-test:: + :delim: , + .. <- meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + ..^^^^^^^ meta.directive.option meta.field-list.item meta.mapping + ..^^^^ meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + .. ^ meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.end + .. ^ meta.directive.option meta.field-list.item meta.mapping meta.separator.key-value + .. ^ meta.directive.option meta.field-list.item meta.mapping.value + directive-option-test body + +.. directive-option-test:: + :encoding: utf_8 + .. <- meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + ..^^^^^^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping + ..^^^^^^^ meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + .. ^ meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.end + .. ^ meta.directive.option meta.field-list.item meta.mapping meta.separator.key-value + .. ^^^^^ meta.directive.option meta.field-list.item meta.mapping.value + directive-option-test body + +.. directive-option-test:: + :height: 100px + .. <- meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + ..^^^^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping + ..^^^^^ meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + .. ^ meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.end + .. ^ meta.directive.option meta.field-list.item meta.mapping meta.separator.key-value + .. ^^^^^ meta.directive.option meta.field-list.item meta.mapping.value + directive-option-test body + +.. directive-option-test:: + :loading: lazy + .. <- meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + ..^^^^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping + ..^^^^^^ meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + .. ^ meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.end + .. ^ meta.directive.option meta.field-list.item meta.mapping meta.separator.key-value + .. ^^^^ meta.directive.option meta.field-list.item meta.mapping.value + directive-option-test body + +.. directive-option-test:: + :scale: 50% + .. <- meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + ..^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping + ..^^^^ meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + .. ^ meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.end + .. ^ meta.directive.option meta.field-list.item meta.mapping meta.separator.key-value + .. ^^^ meta.directive.option meta.field-list.item meta.mapping.value + directive-option-test body + +.. directive-option-test:: + :width: 100px + .. <- meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + ..^^^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping + ..^^^^ meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + .. ^ meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.end + .. ^ meta.directive.option meta.field-list.item meta.mapping meta.separator.key-value + .. ^^^^^ meta.directive.option meta.field-list.item meta.mapping.value + directive-option-test body + +.. directive-option-test:: + :widths: 2,2,2,2,2 + .. <- meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + ..^^^^^^^^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping + ..^^^^^ meta.directive.option meta.field-list.item meta.mapping.key entity.name.other.key + .. ^ meta.directive.option meta.field-list.item meta.mapping.key punctuation.definition.generic.end + .. ^ meta.directive.option meta.field-list.item meta.mapping meta.separator.key-value + .. ^^^^^^^^^ meta.directive.option meta.field-list.item meta.mapping.value + directive-option-test body + +.. directive-option-test:: + directive-option-test body + +.. note:: Single line note +.. <- meta.other.directive punctuation.definition.directive + .. <- meta.other.directive punctuation.definition.directive +..^^^^^^^^^^^^^^^^^^^^^^^^ meta.other.directive +.. ^^ meta.other.directive punctuation.separator.key-value + +.. note:: + .. <- meta.other.directive constant.language.directive-name + .. <- meta.other.directive constant.language.directive-name + ..^^ meta.other.directive constant.language.directive-name + .. ^^ meta.other.directive + .. ^^ punctuation.separator.key-value + + Outer note + + .. note:: Inner single line note + .. <- punctuation.definition.directive + .. ^^^^ meta.other.directive + .. ^^ punctuation.separator.key-value + +.. someOtherN4M3:: paragraph +.. ^^^^^^^^^^^^^ meta.other.directive constant.other.directive-name + + + +.. BODY ELEMENTS / EXPLICIT MARKUP BLOCKS / SUBSTITUTION DEFINITIONS .......... + + + +.. |substitution substitution| image:: img.png +.. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.info.substitution-definition +.. ^ markup.info.substitution-definition punctuation.definition.substitution.begin +.. ^^^^^^^^^^^^^^^^^^^^^^^^^ markup.info.substitution-definition markup.deleted +.. ^ markup.info.substitution-definition punctuation.definition.substitution.end +.. ^ markup.info.substitution-definition +.. ^^^^^^^^^^^^^^^ markup.info.substitution-definition markup.inserted +.. ^^^^^ meta.generic.inline-compatible-directive +.. ^^ punctuation.definition.directive + + + +.. BODY ELEMENTS / EXPLICIT MARKUP BLOCKS / COMMENTS .......................... + + + +.. a comment +.. <- comment.block.double-dot punctuation.definition.comment + .. <- comment.block.double-dot punctuation.definition.comment +..^^^^^^^^^^ comment.block.double-dot + +.. + a multi-line comment is indented after initial .. +..^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block.double-dot + +.. + a multi-line comment ends at the first character in the + first column +This is not a comment +.. <- meta.paragraph - comment + +.. multi line comments can contain blank lines. + + These are still part of the comment + if they're indented. +.. ^ comment.block.double-dot + +.. Comments + .. cannot be nested. +.. ^^^^^^^^^^^^^^^^^^^^ comment.block.double-dot - comment comment + +.. + _comment: comment! +..^^^^^^^^^^^^^^^^^^ comment.block.double-dot - markup + +.. + [comment] comment! +..^^^^^^^^^^^^^^^^^^ comment.block.double-dot - markup + +.. + comment:: comment! +..^^^^^^^^^^^^^^^^^^ comment.block.double-dot - markup - meta.other.directive + +.. + |comment| comment:: | +..^^^^^^^^^^^^^^^^^^^^^ comment.block.double-dot - markup +.. TODO: not substitution definition + +paragraph before empty block comment + +.. + +paragraph after empty block comment + +... not a comment +.. ^^^^^^^^^^^^^ meta.paragraph - comment + + + +.. BODY ELEMENTS / BLOCK QUOTES ............................................... + + + +.. FIXME: highlighting attributions +.. TODO: fix block-quotes separated by empty comments + +start block-quote test + +block-quote with three dashes attribution + + block-quote paragraph with **bold text** test + block-quote paragraph with *italic text* test + --- Attribution + Attribution + +block-quote with three dashes (and no whitespace) attribution + + block-quote paragraph with **bold text** test + block-quote paragraph with *italic text* test + ---Attribution + Attribution + +block-quote with two dashes attribution + + block-quote paragraph with **bold text** test + block-quote paragraph with *italic text* test + -- Attribution + Attribution + +block-quote with two dashes (and no whitespace) attribution + + block-quote paragraph with **bold text** test + block-quote paragraph with *italic text* test + --Attribution + Attribution + +block-quote with one em-dash attribution + + block-quote paragraph with **bold text** test + block-quote paragraph with *italic text* test + — Attribution + Attribution + +block-quote with one em-dash (and no whitespace) attribution + + block-quote paragraph with **bold text** test + block-quote paragraph with *italic text* test + —Attribution + Attribution + +end block-quote test + + + +.. BODY ELEMENTS / DOCTEST BLOCKS ............................................. + + + +>>> print("hello world") +.. ^^^^^^^^^^^^^^^^^^^^^ text.restructuredtext.embedded.python source.python.embedded + +.. <- text.restructuredtext - source + + + +.. BODY ELEMENTS / TABLES / GRID TABLES ....................................... + + + ++------------------------+------------+----------+----------+ +| Header row, column 1 | Header 2 | Header 3 | Header 4 | +| (header rows optional) | | | | ++========================+============+==========+==========+ +| body row 1, column 1 | column 2 | column 3 | column 4 | ++------------------------+------------+----------+----------+ +| body row 2 | Cells may span columns. | ++------------------------+------------+---------------------+ +| body row 3 | Cells may | - Table cells | ++------------------------+ span rows. | - contain | +| body row 4 | | - body elements. | ++------------------------+------------+---------------------+ +| ``inline literal`` | | | ++------------------------+------------+---------------------+ +| **inline bold** | | | ++------------------------+------------+---------------------+ +| *inline italic* | | | ++------------------------+------------+---------------------+ +| _`internal target` | | | ++------------------------+------------+---------------------+ +| `test test's`_ | named hyperlink | ++------------------------+------------+---------------------+ +| `test test's`__ | anonymous hyperlink | ++------------------------+------------+---------------------+ +| - unordered list item | | | ++------------------------+------------+---------------------+ +| * unordered list item | | | ++------------------------+------------+---------------------+ +| 1. ordered list item | | | ++------------------------+------------+---------------------+ +| a. ordered list item | | | ++------------------------+------------+---------------------+ +| I. ordered list item | | | ++------------------------+------------+---------------------+ + + + +.. BODY ELEMENTS / TABLES / SIMPLE TABLES ..................................... + +.. TODO: # # # # # # # # # # + +.. BODY ELEMENTS / LISTS / BULLET LISTS ....................................... + + + +.. with a star + +* one +* two + two + + two +* three +.. <- markup.list.unnumbered markup.list.unnumbered.bullet punctuation.definition.list_item + .. <- markup.list.unnumbered - bullet - punctuation +..^^^^^ markup.list.unnumbered + +.. or a minus + +- one +- two + two + + two +- three +.. <- markup.list.unnumbered markup.list.unnumbered.bullet punctuation.definition.list_item + .. <- markup.list.unnumbered - bullet - punctuation +..^^^^^ markup.list.unnumbered + +.. or a plus + ++ one ++ two + two + + two ++ three +.. <- markup.list.unnumbered markup.list.unnumbered.bullet punctuation.definition.list_item + .. <- markup.list.unnumbered - bullet - punctuation +..^^^^^ markup.list.unnumbered + + + +.. BODY ELEMENTS / LISTS / ENUMERATED LISTS ................................... + + + +.. with a number + +1. one +(2) two + two + + two +3) three +.. <- markup.list.numbered markup.list.numbered.bullet punctuation.definition.list_item + .. <- markup.list.numbered markup.list.numbered.bullet punctuation.definition.list_item +..^^^^^^ markup.list.numbered - bullet - punctuation + +.. or a letter + +a. one +(b) two + two + + two +c) three +.. <- markup.list.numbered markup.list.numbered.bullet punctuation.definition.list_item + .. <- markup.list.numbered markup.list.numbered.bullet punctuation.definition.list_item +..^^^^^^ markup.list.numbered - bullet - punctuation + +.. or a Roman numeral + +I. one +(II) two + two + + two +III) three +.. <- markup.list.numbered markup.list.numbered.bullet punctuation.definition.list_item + .. <- markup.list.numbered markup.list.numbered.bullet punctuation.definition.list_item +..^^ markup.list.numbered markup.list.numbered.bullet punctuation.definition.list_item +.. ^^^^^^ markup.list.numbered - bullet - punctuation + + + +.. BODY ELEMENTS / LISTS / DEFINITION LISTS ................................... + + + +one + Definition one. +two : optional-classifier : optional-classifier : optional-classifier + Definition two. + Definition two. + Definition two. +three + Definition three. + + + +.. BODY ELEMENTS / LISTS / FIELD LISTS ........................................ + + + +:Date: 2024-12-31 + +:Authors: - Author A + - Author B + - Author C + +:Version: 2024.12.31 +.. <- meta.field-list.item meta.mapping.key punctuation.definition.generic.begin + .. <- meta.field-list.item meta.mapping.key entity.name.tag +..^^^^^^^^^^^^^^^^^^ meta.field-list.item meta.mapping +..^^^^^^^ meta.field-list.item meta.mapping.key +..^^^^^^ meta.field-list.item meta.mapping.key entity.name.tag +.. ^ meta.field-list.item meta.mapping.key punctuation.definition.generic.end +.. ^ meta.mapping meta.separator.key-value +.. ^^^^^^^^^^ meta.field-list.item meta.mapping.value + +.. TODO: match these below +.. :field name: field body +.. :field \: name: field body +.. :field :name: field body +.. :field `interpreted text`:role: name: field body +.. :field **bold** name: field body + + + +.. BODY ELEMENTS / LISTS / OPTION LISTS ....................................... + + + +.. TODO: # # # # # # # # # # + + + +.. BODY ELEMENTS / LINE BLOCKS ................................................ + + + +| This is a line block, + with some **bold** text on the next line. +.. ^^^^^^^^ markup.bold +.. ^ meta.block markup.quote.line-block + +Some other paragraph. + + | This is some indented line block. + | + | This is some indented line block. + | This is some indented line block. +.. ^ meta.block markup.quote.line-block punctuation.definition.generic + +Some other paragraph. + + | This is an indented line block, + | + | with + some **bold** text on the next line. +.. ^^^^^^^^ markup.bold +.. ^ meta.block markup.quote.line-block + + + +.. BODY ELEMENTS / LITERAL BLOCKS ............................................. + + + +: :: + + not a literal block +.. ^^^^^^^^^^^^^^^^^^^ - meta.raw.block - markup.raw.block + +:: + + literal block +.. ^ meta.raw.block markup.raw.block + +:: + + literal block + + still literal block +.. ^ meta.raw.block markup.raw.block + +:: + + literal block + + still literal block without **bold** or other inline markup +.. ^^^^^^^^ - markup.bold +.. ^ meta.raw.block markup.raw.block + +Can start with other text: :: + + literal block +.. ^ meta.raw.block markup.raw.block + +Can start with other text:: + + literal block +.. ^ meta.raw.block markup.raw.block + +:: + + literal block + +:: +* literal block quoted form +* +* literal block quoted form +* literal block quoted form +.. ^ meta.raw.block.quoted-form markup.raw.block + +paragraph +.. <- meta.paragraph - meta.raw.block - markup.raw.block + + + +.. INLINE MARKUP / TEXT STYLES ................................................ + + + +Test Test **bold bold** Test +.. ^^^^^^^^^^^^^ markup.bold +.. ^^ punctuation.definition.bold.begin +.. ^^ punctuation.definition.bold.end + +Test Test *italic italic* Test +.. ^^^^^^^^^^^^^^^ markup.italic +.. ^ punctuation.definition.italic.begin +.. ^ punctuation.definition.italic.end + + + +.. INLINE MARKUP / LITERALS ................................................... + + + +Test Test ````` Test +.. ^^^^^ markup.raw.inline +.. ^^ markup.raw.inline punctuation.definition.raw.begin +.. ^^ markup.raw.inline punctuation.definition.raw.end + +Test Test ``literal literal`` Test +.. ^^^^^^^^^^^^^^^^^^^ markup.raw.inline +.. ^^ markup.raw.inline punctuation.definition.raw.begin +.. ^^ markup.raw.inline punctuation.definition.raw.end + +Test Test ``literal +.. ^^^^^^^^^^ markup.raw.inline +.. ^^ markup.raw.inline punctuation.definition.raw.begin + +.. <- markup.raw.inline invalid.illegal.emptyline +literal`` Test +.. ^^ markup.raw.inline punctuation.definition.raw.end + + +.. INLINE MARKUP / INTERNAL TARGETS ........................................... + + + +Test _`internal target` Test +.. ^^^^^^^^^^^^^^^^^^ markup.underline.link +.. ^^ markup.underline.link punctuation.definition.generic.begin +.. ^ markup.underline.link punctuation.definition.generic.end + +Test _`internal +.. ^^^^^^^^^^ markup.underline.link +.. ^^ markup.underline.link punctuation.definition.generic.begin +.. ^ markup.underline.link invalid.illegal.newline + + + +.. INLINE MARKUP / HYPERLINK REFERENCES ....................................... + + + +.. with one underscore: named + +Test test_ Test +.. ^^^^^ meta.link.reference string.other.link.title +.. ^ meta.link.reference string.other.link.title punctuation.definition.link + +Test test's_ Test +.. ^^^^^^^ meta.link.reference string.other.link.title +.. ^ meta.link.reference string.other.link.title punctuation.definition.link + +Test `test test`_ Test +.. ^^^^^^^^^^^^ meta.link.reference string.other.link.title +.. ^ meta.link.reference string.other.link.title punctuation.definition.link.begin +.. ^^ meta.link.reference string.other.link.title punctuation.definition.link.end + +Test `test test's`_ Test +.. ^^^^^^^^^^^^^^ meta.link.reference string.other.link.title +.. ^ meta.link.reference string.other.link.title punctuation.definition.link.begin +.. ^^ meta.link.reference string.other.link.title punctuation.definition.link.end + +Test `test test `_ Test +.. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.inline +.. ^ meta.link.inline punctuation.definition.link.begin +.. ^^^^^^^^^ meta.link.inline string.other.link.title +.. ^ meta.link.inline punctuation.definition.location.begin +.. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.inline markup.underline.link +.. ^ meta.link.inline punctuation.definition.location.end +.. ^^ meta.link.inline punctuation.definition.link.end + +Test `test test `_ Test +.. ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.inline +.. ^ meta.link.inline punctuation.definition.link.begin +.. ^^^^^^^^^ meta.link.inline string.other.link.title +.. ^ meta.link.inline punctuation.definition.location.begin +.. ^^^^^^^^^^ meta.link.inline markup.underline.link +.. ^ meta.link.inline punctuation.definition.location.end +.. ^^ meta.link.inline punctuation.definition.link.end + +.. with two underscores: anonymous + +Test test__ Test +.. ^^^^^^ meta.link.reference string.other.link.title +.. ^^ meta.link.reference string.other.link.title punctuation.definition.link + +Test test's__ Test +.. ^^^^^^^^ meta.link.reference string.other.link.title +.. ^^ meta.link.reference string.other.link.title punctuation.definition.link + +Test `test test`__ Test +.. ^^^^^^^^^^^^^ meta.link.reference string.other.link.title +.. ^ meta.link.reference string.other.link.title punctuation.definition.link.begin +.. ^^^ meta.link.reference string.other.link.title punctuation.definition.link.end + +Test `test test's`__ Test +.. ^^^^^^^^^^^^^^^ meta.link.reference string.other.link.title +.. ^ meta.link.reference string.other.link.title punctuation.definition.link.begin +.. ^^^ meta.link.reference string.other.link.title punctuation.definition.link.end + + + +.. INLINE MARKUP / INTERPRETED TEXT ........................................... + + + +Test Test `interpreted interpreted` Test +.. ^^^^^^^^^^^^^^^^^^^^^^^^^ markup.other +.. ^ punctuation.definition.markup-interpreted.begin +.. ^ punctuation.definition.markup-interpreted.end + +Test Test :emphasis:`interpreted interpreted` Test +.. ^^^^^^^^^^^^^^^^^^^^^^^^^ markup.other +.. ^^^^^^^^^^ storage.type +.. ^ punctuation.definition.markup-interpreted.begin +.. ^ punctuation.definition.markup-interpreted.end + +Test Test `interpreted interpreted`:emphasis: Test +.. ^^^^^^^^^^^^^^^^^^^^^^^^^ markup.other +.. ^ punctuation.definition.markup-interpreted.begin +.. ^ punctuation.definition.markup-interpreted.end +.. ^^^^^^^^^^ storage.type + +Test Test :raw-text:`interpreted interpreted` Test +.. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.other +.. ^^^^^^^^^^ storage.type +.. ^ punctuation.definition.markup-interpreted.begin +.. ^ punctuation.definition.markup-interpreted.end + + + +.. INLINE MARKUP / FOOTNOTE REFERENCES ........................................ + + + +Test Test [0]_ Test +.. ^^^^ meta.link.footnote.numeric +.. ^ meta.link.footnote.numeric punctuation.definition.footnote-reference.begin +.. ^ meta.link.footnote.numeric constant.other.footnote.link +.. ^^ meta.link.footnote.numeric punctuation.definition.footnote-reference.end + +Test Test [#]_ Test [#a]_ Test [#0]_ Test [#footnote]_ Test +.. ^^^^ meta.link.footnote.auto +.. ^^ meta.link.footnote.auto punctuation.definition.footnote-reference.begin +.. ^^ meta.link.footnote.auto punctuation.definition.footnote-reference.end +.. ^^^^^ meta.link.footnote.auto +.. ^^ meta.link.footnote.auto punctuation.definition.footnote-reference.begin +.. ^ meta.link.footnote.auto constant.other.footnote.link +.. ^^ meta.link.footnote.auto punctuation.definition.footnote-reference.end +.. ^^^^^ meta.link.footnote.auto +.. ^^ meta.link.footnote.auto punctuation.definition.footnote-reference.begin +.. ^ meta.link.footnote.auto constant.other.footnote.link +.. ^^ meta.link.footnote.auto punctuation.definition.footnote-reference.end +.. ^^^^^^^^^^^^ meta.link.footnote.auto +.. ^^ meta.link.footnote.auto punctuation.definition.footnote-reference.begin +.. ^^^^^^^^ meta.link.footnote.auto constant.other.footnote.link +.. ^^ meta.link.footnote.auto punctuation.definition.footnote-reference.end + +Test Test [†]_ Test [‡]_ Test [§]_ Test [¶]_ Test [#]_ Test +.. ^^^^ meta.link.footnote.symbol.auto +.. ^ meta.link.footnote.symbol.auto punctuation.definition.footnote-reference.begin +.. ^ meta.link.footnote.symbol.auto constant.other.footnote.link +.. ^^ meta.link.footnote.symbol.auto punctuation.definition.footnote-reference.end +.. ^^^^ meta.link.footnote.symbol.auto +.. ^ meta.link.footnote.symbol.auto punctuation.definition.footnote-reference.begin +.. ^ meta.link.footnote.symbol.auto constant.other.footnote.link +.. ^^ meta.link.footnote.symbol.auto punctuation.definition.footnote-reference.end +.. ^^^^ meta.link.footnote.symbol.auto +.. ^ meta.link.footnote.symbol.auto punctuation.definition.footnote-reference.begin +.. ^ meta.link.footnote.symbol.auto constant.other.footnote.link +.. ^^ meta.link.footnote.symbol.auto punctuation.definition.footnote-reference.end +.. ^^^^ meta.link.footnote.symbol.auto +.. ^ meta.link.footnote.symbol.auto punctuation.definition.footnote-reference.begin +.. ^ meta.link.footnote.symbol.auto constant.other.footnote.link +.. ^^ meta.link.footnote.symbol.auto punctuation.definition.footnote-reference.end +.. TODO: meta.link.footnote.symbol.auto +.. TODO: meta.link.footnote.symbol.auto constant.other.footnote.link + +Test Test [♠️]_ Test [♥️]_ Test [♦️]_ Test [♣️]_ Test +.. ^^^^^ meta.link.footnote.symbol.auto +.. ^ meta.link.footnote.symbol.auto punctuation.definition.footnote-reference.begin +.. ^^ meta.link.footnote.symbol.auto constant.other.footnote.link +.. ^^ meta.link.footnote.symbol.auto punctuation.definition.footnote-reference.end +.. ^^^^^ meta.link.footnote.symbol.auto +.. ^ meta.link.footnote.symbol.auto punctuation.definition.footnote-reference.begin +.. ^^ meta.link.footnote.symbol.auto constant.other.footnote.link +.. ^^ meta.link.footnote.symbol.auto punctuation.definition.footnote-reference.end +.. ^^^^^ meta.link.footnote.symbol.auto +.. ^ meta.link.footnote.symbol.auto punctuation.definition.footnote-reference.begin +.. ^^ meta.link.footnote.symbol.auto constant.other.footnote.link +.. ^^ meta.link.footnote.symbol.auto punctuation.definition.footnote-reference.end +.. ^^^^^ meta.link.footnote.symbol.auto +.. ^ meta.link.footnote.symbol.auto punctuation.definition.footnote-reference.begin +.. ^^ meta.link.footnote.symbol.auto constant.other.footnote.link +.. ^^ meta.link.footnote.symbol.auto punctuation.definition.footnote-reference.end + + + +.. INLINE MARKUP / SUBSTITUTION REFERENCES .................................... + + + +Test Test |substitution substitution| Test +.. ^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.substitution +.. ^ punctuation.definition.substitution.begin +.. ^ punctuation.definition.substitution.end +.. ^ - markup + +Test Test |substitution substitution|_ Test +.. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.substitution +.. ^ punctuation.definition.substitution.begin +.. ^^ punctuation.definition.substitution.end +.. ^ - markup + +Test Test |substitution substitution|__ Test +.. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.substitution +.. ^ punctuation.definition.substitution.begin +.. ^^^ punctuation.definition.substitution.end +.. ^ - markup + + +.. INLINE MARKUP / STANDALONE LINKS ........................................... + +.. TODO: # # # # # # # # # # + +.. INLINE MARKUP / REPLACEMENTS ............................................... + +.. TODO: # # # # # # # # # #