Code syntax highlighting the same way I see it on my local machine when building the docs with sphinx-build.
No code syntax highlighting. This is also the case for other readthedocs.io sites which have the rdt_theme enabled.
My guess is that it only happens on the rtd theme. Any hints?
also the official theme websitehas no highlighting, as well: http://sphinx-rtd-theme.readthedocs.io/en/latest/demo/demo.html#code-blocks
Syntax highlighting was added to the theme recently https://github.com/rtfd/sphinx_rtd_theme/pull/448. However, this version isn't yet the default version on Read the Docs. We are working through a few issues with upgrading the theme and we hope to have this as the default version in a few weeks.
In the meantime, you can pin the version to sphinx_rtd_theme>=0.3.1 to get syntax highlighting.
yes pinning worked for me. thank you.
feel free to close or keep it open for users to see.
Thanks for solution, it works for me too, but I have also to add
.highlight {
background: #ffffff !important;
}
in my style.css to make the background white again.
Huh, @Blendify I think the changed background of highlighted text should be part of the rtd theme style.
After https://github.com/rtfd/sphinx_rtd_theme/pull/448 was merged, the highlighted text background is now green and keeping it consistent with the rtd theme background would make sense.
edit: @PoslavskySV oh wait are you using pygments_style = 'sphinx'? pygments_style = 'default' should be fine.
The default style set by the theme is default however I think for older projects sphinx set the default to sphinx and would always override the theme. I do not think this is the case anymore though.
In the meantime, you can pin the version to sphinx_rtd_theme>=0.3.1 to get syntax highlighting.
I am new to RTD and Sphinx. I had to figure out how to do this. If you are in the same boat, I documented the steps in this thread:
https://github.com/rtfd/readthedocs.org/issues/4072
I'm going to re-open this until https://github.com/rtfd/readthedocs.org/pull/4096 is fixed.
Most helpful comment
Syntax highlighting was added to the theme recently https://github.com/rtfd/sphinx_rtd_theme/pull/448. However, this version isn't yet the default version on Read the Docs. We are working through a few issues with upgrading the theme and we hope to have this as the default version in a few weeks.
In the meantime, you can pin the version to
sphinx_rtd_theme>=0.3.1to get syntax highlighting.