Now that this blog is self-hosted I can display Python and other code rather better. After trying a half dozen possibilities I settled on the free WordPress plugin Urvanov Syntax Highlighter. Works with the Classic editor in txt mode, and has none of that Blocks nonsense.
Embedding in a post is via a form, or more simply via a blog code snippet…
1 2 3 |
<pre class="nums:false lang:python decode:true " > add code here <pre> |
It has a very large range of display colouring options. Doesn’t mess with the Python code, so if the plugin fails the code is still valid in plain-text. Doesn’t mess with stuff in existing code tags.