runtime(rst): Fix highlights nested in directive body
Commit:
https://github.com/vim/vim/commit/47949b4b46965fdabbbe84cbe14027890d4ed3b8
Author: Minjie Xu <[email protected]>
Date: Mon Oct 13 18:27:49 2025 +0000
runtime(rst): Fix highlights nested in directive body
The leading two dots of a RST directive gets matched by
rstExplicitMarkup group first, and then the directive name and directive
body will be matched by the groups contained in rstDirectives cluster in
order.
The rstExDirective group in rstDiretives matches any RST directives
other than footnote, citation and hyperlink target, therefore admonition
and code block will be matched by rstExDirective. This fix has
rstExDirective contain rstExplicitMarkup so as to enable recursive RST
directives match.
The interpreted texts enclosed in quotes are not highlighted within a
RST directive body, because the rstCruft cluster contains a non-existing
rstInterpretedText group.It should be renamed to
rstInterpretedTextOrHyperlinkReference which is defined in a
DefineInlineMarkup function call.
related: #18566
Signed-off-by: Minjie Xu <[email protected]>
Signed-off-by: Marshall Ward <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/runtime/syntax/rst.vim b/runtime/syntax/rst.vim
index 34e43932b..4b9379f5e 100644
--- a/runtime/syntax/rst.vim
+++ b/runtime/syntax/rst.vim
@@ -17,8 +17,9 @@ syn case ignore
syn match rstTransition /^[=`:.'"~^_*+#-]\{4,}\s*$/
syn cluster rstCruft contains=rstEmphasis,rstStrongEmphasis,
- \ rstInterpretedText,rstInlineLiteral,rstSubstitutionReference,
- \ rstInlineInternalTargets,rstFootnoteReference,rstHyperlinkReference
+ \ rstInterpretedTextOrHyperlinkReference,rstInlineLiteral,
+ \ rstSubstitutionReference,rstInlineInternalTargets,rstFootnoteReference,
+ \ rstHyperlinkReference
syn region rstLiteralBlock matchgroup=rstDelimiter
\ start='\(^\z(\s*\).*\)\@<=::
\s*
' skip='^\s*$' end='^\(\z1\s\+\)\@!'
@@ -87,7 +88,7 @@ syn region rstHyperlinkTarget matchgroup=rstDirective
execute 'syn region rstExDirective contained matchgroup=rstDirective' .
\ ' start=+' . s:ReferenceName . '::\_s+' .
\ ' skip=+^$+' .
- \ ' end=+^\s\@!+ contains=@rstCruft,rstLiteralBlock'
+ \ ' end=+^\s\@!+ contains=@rstCruft,rstLiteralBlock,rstExplicitMarkup'
execute 'syn match rstSubstitutionDefinition contained' .
\ ' /|.*|\_s\+/ nextgroup=@rstDirectives'
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/vim_dev/E1v8NXh-00Cgou-ME%40256bit.org.