summaryrefslogtreecommitdiff
path: root/sphinx/highlighting.py
diff options
context:
space:
mode:
Diffstat (limited to 'sphinx/highlighting.py')
-rw-r--r--sphinx/highlighting.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/sphinx/highlighting.py b/sphinx/highlighting.py
index 5d2f686dc..aa78b5b2e 100644
--- a/sphinx/highlighting.py
+++ b/sphinx/highlighting.py
@@ -183,9 +183,13 @@ class PygmentsBridge(object):
formatter = self.get_formatter(**kwargs)
try:
hlsource = highlight(source, lexer, formatter)
- except ErrorToken:
+ except ErrorToken as exc:
# this is most probably not the selected language,
# so let it pass unhighlighted
+ if warn:
+ warn('Could not parse literal_block as "%s". highlighting skipped.' % lang)
+ else:
+ raise exc
hlsource = highlight(source, lexers['none'], formatter)
if self.dest == 'html':
return hlsource