Skip to content

Commit 47949b4

Browse files
madjxatwchrisbra
authored andcommitted
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 <madjxatw@gmail.com> Signed-off-by: Marshall Ward <marshall.ward@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
1 parent 310082f commit 47949b4

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

runtime/syntax/rst.vim

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ syn case ignore
1717
syn match rstTransition /^[=`:.'"~^_*+#-]\{4,}\s*$/
1818

1919
syn cluster rstCruft contains=rstEmphasis,rstStrongEmphasis,
20-
\ rstInterpretedText,rstInlineLiteral,rstSubstitutionReference,
21-
\ rstInlineInternalTargets,rstFootnoteReference,rstHyperlinkReference
20+
\ rstInterpretedTextOrHyperlinkReference,rstInlineLiteral,
21+
\ rstSubstitutionReference,rstInlineInternalTargets,rstFootnoteReference,
22+
\ rstHyperlinkReference
2223

2324
syn region rstLiteralBlock matchgroup=rstDelimiter
2425
\ start='\(^\z(\s*\).*\)\@<=::\n\s*\n' skip='^\s*$' end='^\(\z1\s\+\)\@!'
@@ -87,7 +88,7 @@ syn region rstHyperlinkTarget matchgroup=rstDirective
8788
execute 'syn region rstExDirective contained matchgroup=rstDirective' .
8889
\ ' start=+' . s:ReferenceName . '::\_s+' .
8990
\ ' skip=+^$+' .
90-
\ ' end=+^\s\@!+ contains=@rstCruft,rstLiteralBlock'
91+
\ ' end=+^\s\@!+ contains=@rstCruft,rstLiteralBlock,rstExplicitMarkup'
9192

9293
execute 'syn match rstSubstitutionDefinition contained' .
9394
\ ' /|.*|\_s\+/ nextgroup=@rstDirectives'

0 commit comments

Comments
 (0)