pydata_sphinx_theme.toctree#

Methods to build the toctree used in the html pages.

Module Contents#

Functions#

_get_ancestor_pagename(app, pagename, startdepth)

Get the name of pagename's ancestor that is rooted startdepth levels below the global root.

add_collapse_checkboxes(soup)

Add checkboxes to collapse children in a toctree.

add_inline_math(node)

Render a node with HTML tags that activate MathJax processing.

add_toctree_functions(app, pagename, templatename, ...)

Add functions so Jinja templates can add toctree objects.

get_nonroot_toctree(app, pagename, ancestorname, ...)

Get the partial TocTree (rooted at ancestorname) that dominates pagename.

pydata_sphinx_theme.toctree._get_ancestor_pagename(app, pagename, startdepth)[source]#

Get the name of pagename’s ancestor that is rooted startdepth levels below the global root.

Parameters:
  • app (sphinx.application.Sphinx) –

  • pagename (str) –

  • startdepth (int) –

Return type:

str

pydata_sphinx_theme.toctree.add_collapse_checkboxes(soup)[source]#

Add checkboxes to collapse children in a toctree.

Parameters:

soup (bs4.BeautifulSoup) –

Return type:

None

pydata_sphinx_theme.toctree.add_inline_math(node)[source]#

Render a node with HTML tags that activate MathJax processing.

This is meant for use with rendering section titles with math in them, because math outputs are ignored by pydata-sphinx-theme’s header.

related to the behaviour of a normal math node from: sphinx-doc/sphinx

Parameters:

node (docutils.nodes.Node) –

Return type:

str

pydata_sphinx_theme.toctree.add_toctree_functions(app, pagename, templatename, context, doctree)[source]#

Add functions so Jinja templates can add toctree objects.

Parameters:
  • app (sphinx.application.Sphinx) –

  • pagename (str) –

  • templatename (str) –

Return type:

None

pydata_sphinx_theme.toctree.get_nonroot_toctree(app, pagename, ancestorname, toctree, **kwargs)[source]#

Get the partial TocTree (rooted at ancestorname) that dominates pagename.

Parameters: app : Sphinx app. pagename : Name of the current page (as Sphinx knows it; i.e., its relative path from the documentation root). ancestorname : Name of a page that dominates pagename and that will serve as the root of the TocTree fragment. toctree : A Sphinx TocTree object. Since this is always needed when finding the ancestorname (see _get_ancestor_pagename), it’s more efficient to pass it here to re-use it. kwargs : passed to the Sphinx toctree template function.

This is similar to context[“toctree”](**kwargs) (AKA toctree(**kwargs) within a Jinja template), or TocTree.get_toctree_for(), which always uses the “root” doctree (i.e., doctree = self.env.get_doctree(self.env.config.root_doc)).

Parameters:
  • app (sphinx.application.Sphinx) –

  • pagename (str) –

  • ancestorname (str) –