How to display a block of code in a Plone file of restructured text

I am trying to maintain syntax highlighting in cms Plone.

Context: we use the basic Plone installation. Add a document and change the type from HTML to Restructuredtext, then add a simple block of code:

.. code-block :: python

from plone import api

Save the document and you have the following HTML code

<pre class="code python literal-block">
    <span class="keyword namespace">from</span> <span class="name namespace">plone</span> <span class="keyword namespace">import</span> <span class="name">api</span>
</pre>

So, transformations occur, but the classes used here do not match any CSS that I found on the Internet.

Debugging this show will show me docutils.utils.code_analyser.py Lexer. init is called with tokennames = 'long' instead of tokens = 'short'

This is why class names are long. I have two options:

  • find how to change it? (without monkey patches, but the call chain is so big ...)
  • , pygments
+4

All Articles