|
2 | 2 | " Language: reStructuredText documentation format |
3 | 3 | " Maintainer: Marshall Ward <[email protected]> |
4 | 4 | " Previous Maintainer: Nikolai Weibull <[email protected]> |
| 5 | +" Reference: https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html |
5 | 6 | " Website: https://github.com/marshallward/vim-restructuredtext |
6 | | -" Latest Revision: 2020-03-31 |
| 7 | +" Latest Revision: 2025-10-13 |
7 | 8 |
|
8 | 9 | if exists("b:current_syntax") |
9 | 10 | finish |
|
12 | 13 | let s:cpo_save = &cpo |
13 | 14 | set cpo&vim |
14 | 15 |
|
15 | | -syn case ignore |
| 16 | +" reStructuredText is case-insensitive |
| 17 | +syntax case ignore |
16 | 18 |
|
17 | 19 | syn match rstTransition /^[=`:.'"~^_*+#-]\{4,}\s*$/ |
18 | 20 |
|
@@ -97,6 +99,9 @@ execute 'syn region rstExDirective contained matchgroup=rstDirective' . |
97 | 99 | execute 'syn match rstSubstitutionDefinition contained' . |
98 | 100 | \ ' /|.*|\_s\+/ nextgroup=@rstDirectives' |
99 | 101 |
|
| 102 | + |
| 103 | +"" Inline Markup "" |
| 104 | + |
100 | 105 | function! s:DefineOneInlineMarkup(name, start, middle, end, char_left, char_right) |
101 | 106 | " Only escape the first char of a multichar delimiter (e.g. \* inside **) |
102 | 107 | if a:start[0] == '\' |
@@ -190,6 +195,8 @@ execute 'syn match rstHyperlinkReference' . |
190 | 195 | syn match rstStandaloneHyperlink contains=@NoSpell |
191 | 196 | \ "\<\%(\%(\%(https\=\|file\|ftp\|gopher\)://\|\%(mailto\|news\):\)[^[:space:]'\"<>]\+\|www[[:alnum:]_-]*\.[[:alnum:]_-]\+\.[^[:space:]'\"<>]\+\)[[:alnum:]/]" |
192 | 197 |
|
| 198 | +" `code` is the standard reST directive for source code. |
| 199 | +" `code-block` and `sourcecode` are nearly identical directives in Sphinx. |
193 | 200 | syn region rstCodeBlock contained matchgroup=rstDirective |
194 | 201 | \ start=+\%(sourcecode\|code\%(-block\)\=\)::\s*\(\S*\)\?\s*\n\%(\s*:.*:\s*.*\s*\n\)*\n\ze\z(\s\+\)+ |
195 | 202 | \ skip=+^$+ |
|
0 commit comments