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: