diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-10-03 13:30:33 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-10-03 13:30:34 -0700 |
commit | 347408496a08f18b49b3646b6bb20d17cce85632 (patch) | |
tree | 81e9e190c83c0d33e5b0cf45bc0be561868a53e5 /Documentation | |
parent | b1f0a856605981363053941b8210f3cc9389607a (diff) | |
parent | 779a20663230ab068dcbc3c5bc53d44a5e37b0aa (diff) | |
download | git-347408496a08f18b49b3646b6bb20d17cce85632.tar.gz git-347408496a08f18b49b3646b6bb20d17cce85632.tar.xz |
Merge branch 'ik/gitweb-force-highlight'
"gitweb" can spawn "highlight" to show blob contents with
(programming) language-specific syntax highlighting, but only
when the language is known. "highlight" can however be told
to make the guess itself by giving it "--force" option, which
has been enabled.
* ik/gitweb-force-highlight:
gitweb: use highlight's shebang detection
gitweb: remove unused guess_file_syntax() parameter
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/gitweb.conf.txt | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/Documentation/gitweb.conf.txt b/Documentation/gitweb.conf.txt index a79e35024..e6320891b 100644 --- a/Documentation/gitweb.conf.txt +++ b/Documentation/gitweb.conf.txt @@ -246,13 +246,20 @@ $highlight_bin:: Note that 'highlight' feature must be set for gitweb to actually use syntax highlighting. + -*NOTE*: if you want to add support for new file type (supported by -"highlight" but not used by gitweb), you need to modify `%highlight_ext` -or `%highlight_basename`, depending on whether you detect type of file -based on extension (for example "sh") or on its basename (for example -"Makefile"). The keys of these hashes are extension and basename, -respectively, and value for given key is name of syntax to be passed via -`--syntax <syntax>` to highlighter. +*NOTE*: for a file to be highlighted, its syntax type must be detected +and that syntax must be supported by "highlight". The default syntax +detection is minimal, and there are many supported syntax types with no +detection by default. There are three options for adding syntax +detection. The first and second priority are `%highlight_basename` and +`%highlight_ext`, which detect based on basename (the full filename, for +example "Makefile") and extension (for example "sh"). The keys of these +hashes are the basename and extension, respectively, and the value for a +given key is the name of the syntax to be passed via `--syntax <syntax>` +to "highlight". The last priority is the "highlight" configuration of +`Shebang` regular expressions to detect the language based on the first +line in the file, (for example, matching the line "#!/bin/bash"). See +the highlight documentation and the default config at +/etc/highlight/filetypes.conf for more details. + For example if repositories you are hosting use "phtml" extension for PHP files, and you want to have correct syntax-highlighting for those |