mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2026-09-03 20:52:55 -05:00
viewcode: default to python3 highlighting if highlight_language is python3
This commit is contained in:
@@ -139,7 +139,11 @@ def collect_pages(app):
|
||||
# construct a page name for the highlighted source
|
||||
pagename = '_modules/' + modname.replace('.', '/')
|
||||
# highlight the source using the builder's highlighter
|
||||
highlighted = highlighter.highlight_block(code, 'python', linenos=False)
|
||||
if env.config.highlight_language == 'python3':
|
||||
lexer = 'python3'
|
||||
else:
|
||||
lexer = 'python'
|
||||
highlighted = highlighter.highlight_block(code, lexer, linenos=False)
|
||||
# split the code into lines
|
||||
lines = highlighted.splitlines()
|
||||
# split off wrap markup from the first line of the actual code
|
||||
|
||||
Reference in New Issue
Block a user