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>
This commit is contained in:
bart 2025-02-15 23:34:55 +01:00 committed by GitHub
parent 29a02c64e0
commit 3b2667e591
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 1 deletions

View File

@ -28,6 +28,7 @@ Contributors
* Antonio Valentino -- qthelp builder, docstring inheritance
* Antti Kaihola -- doctest extension (skipif option)
* Barry Warsaw -- setup command improvements
* Bart Kamphorst -- warning improvements
* Ben Egan -- Napoleon improvements & viewcode improvements
* Benjamin Peterson -- unittests
* Blaise Laflamme -- pyramid theme

View File

@ -111,6 +111,8 @@ Features added
* #13326: Remove hardcoding from handling :class:`~sphinx.addnodes.productionlist`
nodes in all writers, to improve flexibility.
Patch by Adam Turner.
* #13335: Use ``misc.highlighting_failure`` subtype for Pygments unknown lexers.
Patch by Bart Kamphorst.
Bugs fixed
----------

View File

@ -167,7 +167,11 @@ class PygmentsBridge:
lexer = get_lexer_by_name(lang, **opts)
except ClassNotFound:
logger.warning(
__('Pygments lexer name %r is not known'), lang, location=location
__('Pygments lexer name %r is not known'),
lang,
location=location,
type='misc',
subtype='higlighting_failure',
)
lexer = lexer_classes['none'](**opts)