Sphinx theme for readthedocs.org

Overview

Read the Docs Sphinx Theme

Pypi Version Build Status License Documentation Status

This Sphinx theme was designed to provide a great reader experience for documentation users on both desktop and mobile devices. This theme is used primarily on Read the Docs but can work with any Sphinx project. You can find a working demo of the theme in the theme documentation

Installation

This theme is distributed on PyPI and can be installed with pip:

$ pip install sphinx-rtd-theme

To use the theme in your Sphinx project, you will need to add the following to your conf.py file:

import sphinx_rtd_theme

extensions = [
    ...
    "sphinx_rtd_theme",
]

html_theme = "sphinx_rtd_theme"

For more information read the full documentation on installing the theme

Configuration

This theme is highly customizable on both the page level and on a global level. To see all the possible configuration options, read the documentation on configuring the theme.

Contributing

If you would like to help modify or translate the theme, you'll find more information on contributing in our contributing guide.

Comments
  • Swap to using webpack

    Swap to using webpack

    This is pull request is a follow up to the following issue:

    https://github.com/readthedocs/sphinx_rtd_theme/issues/757

    The live reload server is run with yarn start, the production build is built with yarn build.

    opened by SimonBiggs 26
  • rendering wrong in docutils 0.17 (unordered list, maybe more?)

    rendering wrong in docutils 0.17 (unordered list, maybe more?)

    I am giving this issue a broad title to collect other issues.

    Problem

    With docutils 0.17, it seems that bullet points don't render properly (the marker is missing), spacing too little (see images below)

    An immediate fix is already in sphinx_rtd_theme==0.5.2 (just released), see (#1111, #1112 for issues, #1114 for fix), but that seems to only pin docutils==0.16 so other things that broke should still be tracked. I tested using the sphinx_rtd_theme docs themselves. #1112 shows this with a problem in the sidebar.

    With 0.16:

    image

    With 0.17:

    image

    I originally thought this was another Sphinx problem, but it seems to not be present in the default Sphinx theme, but (only/at least) sphinx_rtd_theme.

    Reproducible Project

    sphinx_rtd_theme with docutils==0.16. Installed from the master branch pip install docutils=0.17 immediately after.

    git clone https://github.com/readthedocs/sphinx_rtd_theme
    cd sphinx_rtd_theme
    git checkout ca2719b
    pip install -e . -r docs/requirements.txt docutils==0.17
    (cd docs ; make clean html)
    # open build/html/changelog.html, does not work
    pip install docutils==0.16
    # refresh page, works
    

    Error Logs/Results

    none I see as relevant

    Expected Results

    ...

    Environment Info

    • Python Version: Python 3.7.3
    • Sphinx Version: Sphinx 3.5.3
    • RTD Theme Version: ca2719b
    Package                       Version   Location                          
    ----------------------------- --------- ----------------------------------
    alabaster                     0.7.12    
    Babel                         2.9.0     
    certifi                       2020.12.5 
    chardet                       4.0.0     
    docutils                      0.16      
    idna                          2.10      
    imagesize                     1.2.0     
    Jinja2                        2.11.3    
    MarkupSafe                    1.1.1     
    packaging                     20.9      
    pip                           18.1      
    pkg-resources                 0.0.0     
    Pygments                      2.8.1     
    pyparsing                     2.4.7     
    pytz                          2021.1    
    requests                      2.25.1    
    setuptools                    40.8.0    
    six                           1.15.0    
    snowballstemmer               2.1.0     
    Sphinx                        3.5.3     
    sphinx-rtd-theme              0.5.2     /home/$USER/git/sphinx_rtd_theme
    sphinxcontrib-applehelp       1.0.2     
    sphinxcontrib-devhelp         1.0.2     
    sphinxcontrib-htmlhelp        1.0.3     
    sphinxcontrib-httpdomain      1.7.0     
    sphinxcontrib-jsmath          1.0.1     
    sphinxcontrib-qthelp          1.0.3     
    sphinxcontrib-serializinghtml 1.1.4     
    urllib3                       1.26.4    
    

    See also

    • Docutils 0.17 changelog: https://docutils.sourceforge.io/RELEASE-NOTES.html#id46 (lists changes in outputs)
    • https://github.com/sphinx-doc/sphinx/issues/9061 (sidebar again, looks like sphinx_rtd_theme in that example). I first reported this issue there but it could'nt be reproduced, seems to be sphinx_rtd_theme but not the default theme
    • Plus some more PRs around sphinx-doc/sphinx
    Needed: patch Bug 
    opened by rkdarst 25
  • Fix a number of issues with Webpack

    Fix a number of issues with Webpack

    A few of these squeezed by QA and testing:

    • badge_only.css was copied to the static output path, it wasn't actually building it seems. Added second entry for this to make it easier.
    • jQuery was not being treated as an external library and was vendored into our JS bundle!
    • Having the fonts in a relative path from CSS ('../fonts'), causes CORS issues. Moved /fonts to /sphinx_rtd_theme/static/css/fonts essentially. See #782
    • The dev server wasn't compiling assets consistently for me, tuned it hopefully
    • This does output an unused js/badge_only.js, which I believe is for using CSS through JS. This is a webpack 4 thing and it can't be removed. I say disregard it for now.

    Requires #807, based on that until it's merged, then can be repointed to master Refs #782

    Improvement 
    opened by agjohnson 21
  • Sphinx deprecation warning

    Sphinx deprecation warning

    Problem

    sphinx_rtd_theme/search.html:20: RemovedInSphinx30Warning: To modify script_files in the theme is deprecated. Please insert a