preserve lang attribute in <pre> codeblocks
See original GitHub issueOn PyPI, fenced code blocks from markdown are translated to HTML as
<pre>
...
</pre>
On GitHub, the HTML preserves the language attribute (if given),
<pre lang="python">
...
</pre>
This helps third-party applications, like my Purple Pi, to do fancy stuff. (In the case of Purple Pi to render LaTeX math.) I’d love to see this on PyPI, too.
Issue Analytics
- State:
- Created 2 years ago
- Comments:18 (14 by maintainers)
Top Results From Across the Web
Semantics, standards and using the "lang" attribute for source ...
To answer this question, we should look at two things; any potentially relevant specifications, and what is actually done in the real world....
Read more >Add selected language as a `data-` attribute in rendered code ...
It looks fine on a static block but I'm playing with scrolling the code block at fixed height, so it disappears on scroll...
Read more >1 Code::Blocks Project Management
In Code::Blocks, multiple projects can be open. By saving open projects via 'File' →'Save workspace' you can collect them in a single workspace...
Read more >codeblock - OASIS Open
The element represents lines of program code. Like the element, content of this element has preserved line endings and is output in a...
Read more >Code blocks - APIdocs documentation - GitHub Pages
To mark a block-level code fragment for highlighting, use the pre tag with the data-language attribute defining the language of the contents. See...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I haven’t taken a look, but if it’s bringing
cmarkgfm
more inline with what GFM is actually doing, that sounds good to me.If it changes the styles significantly, we’ll make the necessary changes here (and downstream on PyPI) once we update the pin.
I tried again and found, contrary to your results, that GitHub does preserve the lang attribute. For example, the README.md
produces
lang="abc"
.See here for a test repo.
(I might be slow to reply since I’m holidays right now.)