Skip to content

Commit 3b2667e

Browse files
Use the misc.highlighting_failure warning sub-type for PygmentsBridge.get_lexer() (#13335)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
1 parent 29a02c6 commit 3b2667e

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

AUTHORS.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Contributors
2828
* Antonio Valentino -- qthelp builder, docstring inheritance
2929
* Antti Kaihola -- doctest extension (skipif option)
3030
* Barry Warsaw -- setup command improvements
31+
* Bart Kamphorst -- warning improvements
3132
* Ben Egan -- Napoleon improvements & viewcode improvements
3233
* Benjamin Peterson -- unittests
3334
* Blaise Laflamme -- pyramid theme

CHANGES.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ Features added
111111
* #13326: Remove hardcoding from handling :class:`~sphinx.addnodes.productionlist`
112112
nodes in all writers, to improve flexibility.
113113
Patch by Adam Turner.
114+
* #13335: Use ``misc.highlighting_failure`` subtype for Pygments unknown lexers.
115+
Patch by Bart Kamphorst.
114116

115117
Bugs fixed
116118
----------

sphinx/highlighting.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,11 @@ def get_lexer(
167167
lexer = get_lexer_by_name(lang, **opts)
168168
except ClassNotFound:
169169
logger.warning(
170-
__('Pygments lexer name %r is not known'), lang, location=location
170+
__('Pygments lexer name %r is not known'),
171+
lang,
172+
location=location,
173+
type='misc',
174+
subtype='higlighting_failure',
171175
)
172176
lexer = lexer_classes['none'](**opts)
173177

0 commit comments

Comments
 (0)