15

I have a set of rst files that I am building in readthedocs with sphinx. The files have multiple bullet lists, but they are not being rendered correctly.

The text appears, but there are no bullet symbols or nesting / indentation.

To make sure it was not my files, I did a direct copy-paste from the sphinx_rtd_theme page (https://github.com/readthedocs/sphinx_rtd_theme/blob/b07560bf97dad3a4266f6145bd4b662ac708ab00/docs/demo/lists_tables.rst)

This is what the rst is supposed to render as (with ::marker for each list item in the html file)

enter image description here

This is what I am getting when I build the same rst using my local sphinx / rtd setup

enter image description here

Is there something I need to fix in my conf.py or other files?

mzjn
  • 48,958
  • 13
  • 128
  • 248
FlyingTurbine
  • 323
  • 2
  • 9
  • Hello! You might be able to narrow down your problem a bit if you create an out of the box sphinx-quickbuild project using the RTD theme and see if the problem still exists when you include some bulleted lists. – morric May 15 '21 at 09:24
  • Please edit your question to include any errors with loading CSS or JS files. Often when loading local files, browsers will block static assets for security. – Steve Piercy May 15 '21 at 16:14

8 Answers8

18

We had the same issue (bullet points disappearing in lists) after refreshing the conda environment we use for releasing one of our packages. The other solutions listed here (thus far) didn't work for me, but downgrading docutils <0.17 did.

We are using nbsphinx (some of our docs illustrate operations with notebooks), and had recently some issues due to related package versions (jinja2, sphinx, docutils). Based on issues/comments (such as this one and that one), we used various older versions of these packages.

But as of this writing and thanks to the hard work of all the maintainers, we were able to remove all pins except for docutils. FWIW, for our current needs, the relevant subset of packages we use is:

docutils                  0.16                     py38_1  
jinja2                    3.0.0              pyhd3eb1b0_0  
nbsphinx                  0.8.6              pyhd8ed1ab_1    conda-forge
sphinx                    4.0.1              pyhd3eb1b0_0  
sphinx_rtd_theme          0.4.3                      py_0  
Pierre D
  • 24,012
  • 7
  • 60
  • 96
  • More info on this bug at https://sourceforge.net/p/docutils/bugs/417/ (it's not actually a bug in docutils, but in the CSS somewhere) – Nick Crews Feb 10 '22 at 00:33
  • Edit: that CSS bug is in `sphinx_rtd_theme` (https://github.com/readthedocs/sphinx_rtd_theme/issues/1115). At this point, upgrading sphinx_rtd_theme>=0.5.1 worked for us (As well as upgrading sphinx>=4.3.0, but not sure if that is required. See github.com/dedupeio/dedupe/pull/961) – Nick Crews Feb 10 '22 at 17:51
8

I had the same issue when using Read-The-Docs as a theme along with Sphinx-AutoAPI. Based on the answer of "Pierre D" I downgraded the docutils using:

conda install docutils=0.16

The solution worked for me. Both, missing bullets and the elongated line spacings were resolved. I guess the problem is caused by a bug in the docutils package and hope it will be fixed soon.

mmtechslv
  • 126
  • 1
  • 3
6

Other answers here point to docutils as the having the bug. But, the bug is actually in sphinx-rtd-theme. So, even though downgrading docutils seems to work, the solution that worked for us, that I think is better, is to upgrade sphinx and sphinx-rtd-theme past the bugfix. For us, that looked like requiring sphinx>=4.3.0 and sphinx-rtd-theme>=0.5.1 (see our PR)

Nick Crews
  • 837
  • 10
  • 13
4

Seems to be a issue with sphinx_rtd_theme and new HTML5 tags in docutils. See https://github.com/readthedocs/sphinx_rtd_theme/issues/1115 for more info. As mentioned, current resolution is downgrade to docutils=0.16.

ranger_rick
  • 120
  • 1
  • 7
  • 1
    Or, at this point, upgrading `sphinx_rtd_theme>=0.5.1` worked for us (As well as upgrading `sphinx>=4.3.0`, but not sure if that is required. See https://github.com/dedupeio/dedupe/pull/961) – Nick Crews Feb 10 '22 at 17:49
3

I just discovered that an RtD documentation set I maintain was experiencing this exact problem, where bullets would show on my local builds (accompanied by the ::marker in the page source) but would be absent in RtD builds (no ::marker in the page source).

I tried a couple of things that didn't work before finding this thread. Nick Crews's answer worked perfectly: I added the >=0.5.1 lower-bound constraint to the requirements-rtd.txt file that I've configured RtD to use (I already had a Sphinx==5.3.0 pin, for reasons), and poof! I had my bullets back.

UPDATE 31 Jan 2023: Based on the comments in this sphinx_rtd_theme GitHub issue, it's also important to be sure that the version of docutils that gets installed is not too high. The thread recommends a constraint of docutils<0.17, though in recent builds my bullets have rendered fine with docutils==0.17.1.


This got me curious as to why it was necessary for me to add this constraint, when I'd already had sphinx-rtd-theme declared in requirements-rtd.txt.

On taking a closer look at my RtD build logs, I discovered that RtD has its own default-requirements install step, prior to installing anything I specify in my config. In this default install step, it was installing sphinx-rtd-theme<5.0:

Collecting sphinx-rtd-theme<0.5
  Downloading sphinx_rtd_theme-0.4.3-py2.py3-none-any.whl (6.4 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.4/6.4 MB 117.0 MB/s eta 0:00:00

Thus, when pip hit the sphinx-rtd-theme line in requirements-rtd.txt, it just ignored it, because a version of it was already installed:

Successfully installed  attrs-22.1.0  importlib-metadata-5.0.0  sphinx-5.3.0
 sphinx-issues-3.0.1  sphinx-removed-in-0.2.1  sphinxcontrib-applehelp-1.0.2 
 sphinxcontrib-devhelp-1.0.2  sphinxcontrib-htmlhelp-2.0.0  sphinxcontrib-jsmath-1.0.1
 sphinxcontrib-programoutput-0.17  sphinxcontrib-qthelp-1.0.3  zipp-3.10.0

Adding the >=0.5.1 constraint thus forces an upgrade/reinstall of sphinx-rtd-theme to the latest version, fixing the problem.


So... where did this sphinx-rtd-theme<0.5 pin come from?

After digging into the RtD source for a while, I found out that there's a toggle for, essentially, "are we using the latest Sphinx version or not?":

# If defaulting to Sphinx 2+, we need to push the latest theme
# release as well. `<0.5.0` is not compatible with Sphinx 2+
self.project.get_feature_value(
    Feature.USE_SPHINX_LATEST,
    positive='sphinx-rtd-theme',
    negative='sphinx-rtd-theme<0.5',
),

So, okaaay... I do want to use a recent version of Sphinx... why am I apparently set up to not USE_SPHINX_LATEST?

Looks like it's a compatibility decision made at some point. Any RtD docset created before a certain date (20 Oct 2020, for a personal project like mine; or, 21 Jan 2021 for RtD for Business projects) is set as not USE_SPHINX_LATEST. I assume these dates were picked for some strategic reason, likely having to do with in-the-wild usage of Sphinx < 2.0 dropping below some threshold.

Anyways! If you see a sphinx-rtd-theme<0.5 and/or sphinx<2 constraint in your RtD build logs, that's why. And, again, follow Nick Crews's advice to fix it.

hBy2Py
  • 1,707
  • 19
  • 29
2

I had the same problem, when listing using *, in the .rst file like:

* first item
* second item

I found out that the problem, in my case, was that I was using the theme sphinx_rtd_theme, but I didn't add it in extensions in the conf.py file. So adding the following worked for me:

extensions = [sphinx_rtd_theme,
# other extensions
]
bad_coder
  • 11,289
  • 20
  • 44
  • 72
  • 1
    As written this fails with `AttributeError: module 'sphinx_rtd_theme' has no attribute 'startswith'`; I think it's looking for a string. Adding instead `'sphinx_rtd_theme'` as a string has no effect. – Reid Jul 21 '21 at 21:55
0

Creating a new sphinx project solved the problem

FlyingTurbine
  • 323
  • 2
  • 9
0

Had the same problem:

Creating new sphinx-quickstart didn't work.
Reducing docutils to 0.16 and adding 'sphinx_rtd_theme' to the extensions list in conf.py worked:

extensions = ['sphinx_rtd_theme']