runtime(help): Add Vim lang annotation support for codeblocks

Commit: 
https://github.com/vim/vim/commit/6fea0a54804fc36ab7138a66210b0eb380d96198
Author: Shougo Matsushita <shougo.ma...@gmail.com>
Date:   Sun Dec 15 20:47:37 2024 +0100

    runtime(help): Add Vim lang annotation support for codeblocks
    
    closes: https://github.com/vim/vim/issues/16215
    
    Co-authored-by: zeertzjq <zeert...@outlook.com>
    Signed-off-by: Shougo Matsushita <shougo.ma...@gmail.com>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/runtime/doc/helphelp.txt b/runtime/doc/helphelp.txt
index 3da38ecc5..948ef7248 100644
--- a/runtime/doc/helphelp.txt
+++ b/runtime/doc/helphelp.txt
@@ -1,4 +1,4 @@
-*helphelp.txt* For Vim version 9.1.  Last change: 2024 Nov 19
+*helphelp.txt* For Vim version 9.1.  Last change: 2024 Dec 15
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -437,7 +437,13 @@ also implicitly stops the block of ex-commands before it.  
E.g. >
        echo "Example"
     endfunction
 <
-
+It's possible to add Vim syntax highlighting support to code examples.  This
+can be done by adding "vim" after the greater than (>) character (">vim").
+E.g: >vim
+    function Example_Func()
+       echo "Example"
+    endfunction
+<
 The following are highlighted differently in a Vim help file:
   - a special key name expressed either in <> notation as in <PageDown>, or
     as a Ctrl character as in CTRL-X
diff --git a/runtime/syntax/help.vim b/runtime/syntax/help.vim
index ae7e3bc6a..3886164b3 100644
--- a/runtime/syntax/help.vim
+++ b/runtime/syntax/help.vim
@@ -1,7 +1,7 @@
 " Vim syntax file
 " Language:    Vim help file
 " Maintainer:  The Vim Project <https://github.com/vim/vim>
-" Last Change: 2024 Oct 16
+" Last Change: 2024 Dec 15
 " Former Maintainer:   Bram Moolenaar <b...@vim.org>
 
 " Quit when a (custom) syntax file was already loaded
@@ -15,10 +15,22 @@ set cpo&vim
 syn match helpHeadline         "^[A-Z.][-A-Z0-9 .,()_']*?\=\ze\(\s\+\*\|$\)"
 syn match helpSectionDelim     "^===.*===$"
 syn match helpSectionDelim     "^---.*--$"
+
+unlet! b:current_syntax
+" sil! to prevent E403
+silent! syntax include @VimScript syntax/vim.vim
 if has("conceal")
   syn region helpExample       matchgroup=helpIgnore start=" >$" start="^>$" 
end="^[^  ]"me=e-1 end="^<" concealends
-else
-  syn region helpExample       matchgroup=helpIgnore start=" >$" start="^>$" 
end="^[^  ]"me=e-1 end="^<"
+  syn region helpExampleVimScript matchgroup=helpIgnore
+        \ start=/^>vim$/ start=/ >vim$/
+        \ end=/^[^     ]/me=e-1 end=/^</ concealends
+        \ contains=@VimScript keepend
+ else
+   syn region helpExample      matchgroup=helpIgnore start=" >$" start="^>$" 
end="^[^  ]"me=e-1 end="^<"
+   syn region helpExampleVimScript matchgroup=helpIgnore
+         \ start=/^>vim$/ start=/ >vim$/
+         \ end=/^[^    ]/me=e-1 end=/^</
+         \ contains=@VimScript keepend
 endif
 if has("ebcdic")
   syn match helpHyperTextJump  "\\@<!|[^"*|]\+|" contains=helpBar

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1tMumY-00GB0r-RV%40256bit.org.

Raspunde prin e-mail lui