westurner

Documentation

This weekend, I managed to get a fixed navigation bar configured
with the Bootstrap affix JS
and a fair amount of CSS iteration
for Sphinx (with the excellent sphinxjp.themes.basicstrap)
and have been merging the new styles into various
sets of docs that I’ve been working on:

[o] [UBY] show the currently #manually-selected link in the navbar
when the fixed navbar is scrolled beyond the viewport
(i.e. when showing the complete table of contents in the
full width sidebar navbar).

[x] Assert #anchor exists as a DOM element
with an id="anchor" property.

[o] Find and style each link to #anchor (href="#anchor"):

[X] mobile header navbar:

[X] UBY: Bold and add an arrow ⬅
next to the heading,
in place of the ¶ sphinx heading selector link.

[X] full width sidebar navbar:

[X] UBY: Bold and add an arrow ⬅
next to the heading,
in place of the ¶ sphinx heading selector link.

[X] UBY: If the full width sidebar navbar is on the screen;
and there’s a link in the table of contents
to the given #anchor;
and that link is not displayed,
scroll the sidebar navbar
so that the given navbar link is displayed
(with a few at the top, for context).

# on_rtd is whether we are on readthedocs.orgimportoson_rtd=os.environ.get('READTHEDOCS',None)=='True'ifnoton_rtd:# only import and set the theme if we're building docs locallyimportsphinx_rtd_themehtml_theme='sphinx_rtd_theme'html_theme_path=[sphinx_rtd_theme.get_html_theme_path()]# otherwise, readthedocs.org uses their theme by default, so no need to specify it

From casual inspection,
ReadTheDocs rtd_theme takes a different approach:

ReadTheDocs rtd_theme does support scrolling the left navbar
independently from the document;

ReadTheDocs rtd_theme scrolls the navbar and the document;

The ReadTheDocs rtd_theme navbar displays
a document-expanded
but otherwise collapsed
table of contents.