I am having an issue with rendering code blocks in a documentation project using Mkdocs with readthedocs theme. Code blocks seem to not parse correctly new lines, so all code in a code block is rendered as a single line.
The repo can be used to reproduce the example, https://github.com/segrelab/comets-manual. The rendering can be seen in https://segrelab.github.io/comets-manual/.
The only hint I have found on google is this but it doesn't seem to be providing any solution, beyond identifying that the problem is related to css (indeed, I ave tried other themes and the code blocks render correctly).
Does anybody have an idea of how to solve this?
First of all, please make sure that your tool is up to date (I can't reproduce the wrong rendering of the code blocks):
pip install --upgrade mkdocs
If the problem persists, you can make a workaround with extra.css
(by the way, extra.css
and extra.js
must locate at docs/css/extra.css
and docs/js/extra.js
; see this).
By guessing from the current-rendered page, the following should work:
/* docs/css/extra.css */
code, .rst-content tt, .rst-content code {
white-space: pre;
}
which is somehow set to white-space: nowrap;
in the rendered page.