Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to enlarge the sidebar or add a horizontal scrollbar in sphinx (sphinx_rtd_theme)?

I'm a newbie in Sphinx and CSS. Basically when I try to automatically generate the documentation by simply adding 'modules' to default conf.py and using sphinx_rtd_theme, I get too long names (fully qualified domain name) on the sidebar that are not fully displayed because of short sidebar's width.

Is there any way to solve this issue? Adding a horizontal scrollbar? Or enlarge the sidebar's width? Or?

sidebar screenshot

like image 241
Mallamac74 Avatar asked Sep 03 '25 08:09

Mallamac74


1 Answers

The easiest way to arrange the lateral navigational menu is to use custom CSS to enable horizontal scroll-bar.

The steps to do that are few:

  1. Find the div class that wraps the lateral menu (you can use the browser inspector). In the Classic theme the name is sphinxsidebarwrapper;
  2. In _static folder add a new file called custom.css (or other name if you want). If you have one folder for build and one for source (depends on choice made during sphinx-quickstart), use the _static folder in source folder. The CSS file have to contain only one rule:
    .sphinxsidebarwrapper {  overflow-y: scroll; }
    
  3. Add in conf.py the line below, after html_static_path = ['_static']:
    html_css_files = ["custom.css"]
    
like image 197
SimoX Avatar answered Sep 04 '25 23:09

SimoX