summaryrefslogtreecommitdiff
path: root/sphinx/highlighting.py
diff options
context:
space:
mode:
authorEricFromCanada <eric@lassosoft.com>2015-01-05 12:49:06 -0500
committerEricFromCanada <eric@lassosoft.com>2015-01-05 12:58:43 -0500
commita63e4945ea82ce76e3600150862bcaaed759ba8b (patch)
tree812ff2524b189b5d2dabc439070a9f8187e2d5f3 /sphinx/highlighting.py
parent649e2cd41beb714a19091baf5da917315cb7aefd (diff)
downloadsphinx-git-a63e4945ea82ce76e3600150862bcaaed759ba8b.tar.gz
Add highlight_options configuration value
This changeset adds the `highlight_options` configuration value, which specifies a dict of key-value pairs to pass to the Pygments highlighter specified with `highlight_language`. For example, specifying `highlight_options = {'funcnamehighlighting' : False}` for the 'php' lexer will disable function name highlighting. Both the HTML and LaTeX writers have been updated to include the options when calling `highlight_block()`, as long as the currently selected language matches what was set with `highlight_language`, i.e. not when modified by `highlight::` or `code-block::` directives.
Diffstat (limited to 'sphinx/highlighting.py')
-rw-r--r--sphinx/highlighting.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/sphinx/highlighting.py b/sphinx/highlighting.py
index b6062e83e..63a46fbd7 100644
--- a/sphinx/highlighting.py
+++ b/sphinx/highlighting.py
@@ -134,7 +134,7 @@ class PygmentsBridge(object):
else:
return True
- def highlight_block(self, source, lang, warn=None, force=False, **kwargs):
+ def highlight_block(self, source, lang, opts=None, warn=None, force=False, **kwargs):
if not isinstance(source, text_type):
source = source.decode()
@@ -164,7 +164,7 @@ class PygmentsBridge(object):
lexer = lexers[lang]
else:
try:
- lexer = lexers[lang] = get_lexer_by_name(lang)
+ lexer = lexers[lang] = get_lexer_by_name(lang, **opts)
except ClassNotFound:
if warn:
warn('Pygments lexer name %r is not known' % lang)