From 2119a65b860ea6619efe0881118cc3c693558ac5 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Tue, 18 Jun 2019 01:43:14 +0900 Subject: [PATCH] Fix #6497: custom lexers fails highlighting when syntax error --- CHANGES | 2 ++ sphinx/highlighting.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 937e6133f..d10eac164 100644 --- a/CHANGES +++ b/CHANGES @@ -16,6 +16,8 @@ Features added Bugs fixed ---------- +* #6497: custom lexers fails highlighting when syntax error + Testing -------- diff --git a/sphinx/highlighting.py b/sphinx/highlighting.py index 2d825e9f1..b4e63209f 100644 --- a/sphinx/highlighting.py +++ b/sphinx/highlighting.py @@ -139,7 +139,8 @@ class PygmentsBridge: lexer = lexers['none'] if lang in lexers: - lexer = lexers[lang] + # just return custom lexers here (without installing raiseonerror filter) + return lexers[lang] elif lang in lexer_classes: lexer = lexer_classes[lang](**opts) else: