File tree 1 file changed +9
-8
lines changed
1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -157,14 +157,15 @@ def convert_pep_page(pep_number, content):
157
157
div = pep_content .new_tag ('div' )
158
158
div ['class' ] = ['highlight' ]
159
159
cb .wrap (div )
160
- # Highlight existing pure-Python PEPs
161
- if int (pep_number ) in PURE_PYTHON_PEPS :
162
- literal_blocks = pep_content .find_all ('pre' , class_ = 'literal-block' )
163
- for lb in literal_blocks :
164
- block = lb .string
165
- if block :
166
- highlighted = highlight (block , PythonLexer (), HtmlFormatter ())
167
- lb .replace_with (BeautifulSoup (highlighted ).html .body .div )
160
+
161
+ # Default to Python highlighting for '::' code blocks.
162
+ # Other languages can be set like '.. code-block:: c'.
163
+ literal_blocks = pep_content .find_all ('pre' , class_ = 'literal-block' )
164
+ for lb in literal_blocks :
165
+ block = lb .string
166
+ if block :
167
+ highlighted = highlight (block , PythonLexer (), HtmlFormatter ())
168
+ lb .replace_with (BeautifulSoup (highlighted , 'lxml' ).html .body .div )
168
169
169
170
pep_href_re = re .compile (r'pep-(\d+)\.html' )
170
171
You can’t perform that action at this time.
0 commit comments