runtime(rst): Fix doctest block syntax
Commit:
https://github.com/vim/vim/commit/0940465866486db47baa1fe85ebefb6e6fe54612
Author: Kirk Roemer <[email protected]>
Date: Mon Oct 13 18:24:09 2025 +0000
runtime(rst): Fix doctest block syntax
A doctest block usually spans multiple lines, e.g.
>>> print('this is a Doctest block')
this is a Doctest block
Remove ``oneline`` argument to syntax region as this requirement is not
met. Consequently, also remove ``display`` as the prerequisite (the
syntax region is on a single line) is no longer met.
----
Recognise '>>>' inside doctest blocks
Recognise subsequent '>>>' prompts in doctest blocks, e.g.
>>> print('this is a Doctest block')
this is a Doctest block
>>> print('this is a second Doctest block')
this is a second Doctest block
A doctest block usually spans multiple lines, e.g.
>>> print('this is a Doctest block')
this is a Doctest block
related: #18566
Signed-off-by: Kirk Roemer <[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 a90c90be2..c43bda589 100644
--- a/runtime/syntax/rst.vim
+++ b/runtime/syntax/rst.vim
@@ -28,8 +28,11 @@ syn region rstQuotedLiteralBlock matchgroup=rstDelimiter
\ start="::\_s*
\ze\z([!\"#$%&'()*+,-./:;<=>?@[\]^_`{|}~]\)"
\ end='^\z1\@!' contains=@NoSpell
-syn region rstDoctestBlock oneline display matchgroup=rstDelimiter
+syn region rstDoctestBlock matchgroup=rstDoctestBlockPrompt
\ start='^>>>\s' end='^$'
+ \ contains=rstDoctestBlockPrompt
+
+syn match rstDoctestBlockPrompt contained '^>>>\s'
syn region rstTable transparent start='^
\s*+[-=+]\+' end='^$'
\ contains=rstTableLines,@rstCruft
@@ -256,6 +259,7 @@ hi def link rstTransition rstSections
hi def link rstLiteralBlock String
hi def link rstQuotedLiteralBlock String
hi def link rstDoctestBlock PreProc
+hi def link rstDoctestBlockPrompt rstDelimiter
hi def link rstTableLines rstDelimiter
hi def link rstSimpleTableLines rstTableLines
hi def link rstExplicitMarkup rstDirective
--
--
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/E1v8NXf-00Cgo0-PR%40256bit.org.