Closed
Description
In new version 3.3, I found that a new language class appeared in the generated HTML code block, which not exist in previous version 3.2.2.
My code:
import markdown
s = '''
```c
```
'''
extensions = ['extra', 'codehilite']
print(markdown.markdown(s, extensions=extensions))
Output with c
class:
<div class="c codehilite"><pre><span></span><code>
</code></pre></div>
Then I read the docs and tried to disable pygments
configs={
'codehilite': {
'use_pygments': False
}
}
print(markdown.markdown(s, extensions=extensions, extension_configs=configs))
This time it outputs:
<pre><code class="language-c"></code></pre>
My version info:
$ python3 --version
Python 3.8.5
$ python3 -m pip show markdown
pyName: Markdown
Version: 3.3
Summary: Python implementation of Markdown.
Home-page: https://Python-Markdown.github.io/
Author: Manfred Stienstra, Yuri takhteyev and Waylan limberg
Author-email: [email protected]
License: BSD License
Location: /usr/local/lib/python3.8/dist-packages
Requires:
Required-by: xxx
$ python3 -m pip show pygments
Name: Pygments
Version: 2.7.1
Summary: Pygments is a syntax highlighting package written in Python.
Home-page: https://pygments.org/
Author: Georg Brandl
Author-email: [email protected]
License: BSD License
Location: /usr/local/lib/python3.8/site-packages
Requires:
Required-by: xxx
According to this page https://pygments.org/docs/lexers/, there are so many possibilities that the language class mess up with other class with the same name.
When pygments is disabled, the class name has a language-
prefix, which is acceptable.
It would be better if we always add language-
prefix, or just remove it.
Thank you!