Anders
Anders

Reputation: 201

Syntax highlighting on readthedocs.io of sphinx code-block

I'm using RTD + Sphinx for my project ( redgrease = https://github.com/lyngon/redgrease ) and it seems like the syntax highlighting of code-blocks isn't working on the readthedocs.io page.

It only displays black text in a box.

E.g. see list item 3 at: https://redgrease.readthedocs.io/en/latest/intro.html#intro-redgrease

The syntax highlighting works fine when I build locally (with sphinx-build) as well as in VS Code using the reStructuredText plugin.

Working (local)

Screenshot is from local build where it IS working

Not working (readthedocs.io)

Screenshot from readthedocs.io where it IS NOT working

The code blocks are all indented (as they appear inside lists), similar to this:

#. :ref:`Server-side Redis commands <red_commands>`.

    Allowing for ... blah blah ...
    It is ... yada yada ...

    .. code-block:: python
        :emphasize-lines: 8, 11, 13

        import redgrease
        import redgrease.utils

        # ... moar codes ..

What might be going on? Do i need some extension or add some config option? I don't have much trickery going on in the 'conf.py' nor '.readthedocs.yml'. (see repo)

Upvotes: 1

Views: 775

Answers (1)

Anders
Anders

Reputation: 201

The reason was painfully simple.

I had by mistake pinned a really old version of 'sphinx-rtd-theme' in my 'requirements.txt' file.

I had pinned version 0.1.5 instead of the latest 0.5.1
My local env simply had a more recent version.

Doh! 🤦

Upvotes: 2

Related Questions