runtime(help): Add better support for language annotation highlighting
closes: #16238
Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: h_east <h.east.727@gmail.com>
Signed-off-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/runtime/doc/helphelp.txt b/runtime/doc/helphelp.txt
index 948ef72..5ab112d 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 Dec 15
+*helphelp.txt* For Vim version 9.1. Last change: 2024 Dec 25
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -433,17 +433,38 @@
at the end of the line before the block and a less than (<) character as the
first non-blank on a line following the block. Any line starting in column 1
also implicitly stops the block of ex-commands before it. E.g. >
- function Example_Func()
- echo "Example"
- endfunction
+ function Example_Func()
+ 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").
+
+To add annotation in the block, place the annotation (ex: "lua") after a
+greater than (>) character. E.g: >lua
+ print("hello")
+<
+Note: uses lua syntax highlighting, if "lua" key is in
+|g:help_example_languages|.
+
+It's possible to add Vim syntax highlighting support to code examples.
E.g: >vim
- function Example_Func()
- echo "Example"
- endfunction
+ function Example_Func()
+ echo "Example"
+ endfunction
<
+ *g:help_example_languages*
+If you want to change the syntax highlighting in the block, you can
+change it like this: >
+ :let g:help_example_languages = #{ vim: 'vim', sh: 'bash' }
+The key represents the annotation marker name, and the value is the 'syntax'
+name. By default, help files support only Vim script highlighting.
+Note: When setting "g:help_example_languages", if you do not include "vim"
+key, the Vim syntax highlighting will not be enabled. If you set it to an
+empty value, syntax highlighting for embedded languages will be disabled.
+
+Further note: including additional syntax languages into help files may not
+always work perfectly, if the included 'syntax' script does not account for
+such an import.
+ *help-notation*
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