Sphinx: field list becomes <div><dl><dt> & <dt> instead of <table>

Created on 16 Jan 2020  路  3Comments  路  Source: sphinx-doc/sphinx

Describe the bug
Using sphinx-build to generate a field list inside an rst file in creates a defnition list instead (according to the lists explained here https://sphinx-rtd-theme.readthedocs.io/en/latest/demo/lists_tables.html#definition-lists)

To Reproduce
Steps to reproduce the behavior:
index.rst file content

Welcome to my documentation!
========================

 :Author:   abc
 :Contact:  [email protected]
 :Status:   alpha
 :External: a
 :Sphinx:   b

conf.py: (although there are more entries, they where not changed from me and are not relevant i guess)

extensions = [
    'sphinx.ext.autodoc',
    'sphinx.ext.doctest',
#    'sphinx.ext.intersphinx',
    'sphinx.ext.todo',
    'sphinx.ext.coverage',
    'sphinx.ext.mathjax',
    'sphinx.ext.ifconfig',
    'sphinx.ext.viewcode',
    'sphinx.ext.githubpages',
    "sphinx_rtd_theme",
]
import sphinx_rtd_theme
html_theme = "sphinx_rtd_theme"
html_theme_options = {
    'canonical_url': '',
    'logo_only': False,
    'display_version': True,
    'prev_next_buttons_location': 'bottom',
    'style_external_links': False,
    'style_nav_header_background': 'red',
    #Toc options
    'collapse_navigation': False,
    'sticky_navigation': True,
    'navigation_depth': 1,
    'includehidden': True,
    'titles_only': False
}
html_css_files = [
    'custom.css',
]
pygments_style = None

Dockerfile:

FROM python:3
WORKDIR /srv
COPY dockerize/pip.conf/  /etc/pip.conf

# install all needed python modules
COPY dockerize/requirements.txt .
RUN pip install -r requirements.txt

RUN pip config list
RUN python setup.py install

RUN apt update && apt install -y python3-sphinx python3-sphinx-rtd-theme python3-guzzle-sphinx-theme python3-sphinx-bootstrap-theme python3-certifi && apt-get clean all

requirements.txt:

rstcloth
requests
pyyaml
Sphinx
sphinx-rtd-theme
guzzle_sphinx_theme
sphinx_bootstrap_theme

pip.conf:

[global]
no-cache-dir = true
trusted-host = pypi.org
               pypi.python.org
               files.pythonhosted.org
find-links = https://pypi.org/simple/
timeout = 30

Expected behavior
The html output of the example field list should have key and value in one single line, _not with value below_.

Your project
Link to your sphinx project, or attach zipped small project sample.
I try to.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment info

  • OS: [e.g. Unix/Linux/Mac/Win/other with version]
  • Python version: Python 3.8.1
  • Sphinx version: sphinx-build 2.3.1
  • Sphinx extensions: see tar.gz file
  • Extra tools: docker

Additional context
see tar.gz file.

  • [e.g. URL or Ticket]
    No other ticket than this one.
html theme question

Most helpful comment

Since Sphinx-2.0, Sphinx has started to output HTML5 by default. And it converts field lists to definition lists. But, unfortunately, sphinx-rtd-theme does not support it yet. As a workaround, please set html4_writer = True in your conf.py. Then field list is rendered as tables as in the past.

Thanks,

All 3 comments

Since Sphinx-2.0, Sphinx has started to output HTML5 by default. And it converts field lists to definition lists. But, unfortunately, sphinx-rtd-theme does not support it yet. As a workaround, please set html4_writer = True in your conf.py. Then field list is rendered as tables as in the past.

Thanks,

Many thanks. It resolved the issue!

Was this page helpful?
0 / 5 - 0 ratings