Modifying content width of the Sphinx theme 'Read the Docs'

前端 未结 9 857
小鲜肉
小鲜肉 2020-12-13 18:04

I am using \'Read the Docs\' Sphinx theme for my documentation. In the original theme, given below

http://read-the-docs.readthedocs.org/en/latest/theme.html

9条回答
  •  半阙折子戏
    2020-12-13 18:39

    Another option is to create a stylesheet in source/_static with just the css you want, e.g.

    .wy-nav-content {
        max-width: none;
    }
    

    or

    .wy-nav-content {
        max-width: 1200px !important;
    }
    

    Make sure the directory is referenced in source/conf.py - I believe by default there's a line to do this, i.e.

    # Add any paths that contain custom static files (such as style sheets) here,
    # relative to this directory. They are copied after the builtin static files,
    # so a file named "default.css" will overwrite the builtin "default.css".
    html_static_path = ['_static']
    

    Then create a custom layout in source/_templates/layout.html and do something like this to include your stylesheet

    {% extends "!layout.html" %}
    {% block extrahead %}
        
    {% endblock %}
    

    Assuming you called your stylesheet style.css

提交回复
热议问题