mosra / m.css

A no-nonsense, no-JavaScript CSS framework, site and documentation theme for content-oriented websites
https://mcss.mosra.cz
Other
406 stars 92 forks source link

python code highlighting doesn't work #173

Closed kennychowdhary closed 2 years ago

kennychowdhary commented 4 years ago

I added

.. code:: python

    import mypythonlib
    mypythonlib.foo()

to the index.rst file with the m.code plugin but the output is a uniform color. How can I get the output code to display easy-to-read python code?

mosra commented 3 years ago

(Sorry for a three-month-late reply, again.)

Hm, this should work. Is this with the default (dark) theme? Does the output contain highlighting CSS classes at least? If it does, then it might be an issue with the CSS style. In particular, the light theme doesn't have any useful code highlighting style.

mosra commented 2 years ago

Closing due to lack of activity.

egberts commented 2 years ago

Not sure if this is related, but I offer my insight just in case.

https://egbert.net/blog/articles/code-syntax-python-md.html

https://egbert.net/blog/articles/code-syntax-python-rst.html

mosra commented 2 years ago

Yeah this is all doable with the .. code:: directive, which is further improved upon in the m.code plugin.

Not sure what's the point of .. code-block::, I remember Sphinx having it (to not interfere with the builtin .. code:: or why?), but it lacked some features compared to the builtin directive and was longer to type, plus why even have two features for the same thing. I use just .. code::.