ipypublish.sphinx.notebook.transforms module

adapted from nbsphinx

class ipypublish.sphinx.notebook.transforms.CreateDomainObjectLabels(document, startnode=None)[source]

Bases: docutils.transforms.Transform

Create labels for domain-specific object signatures.

apply()[source]

Override to apply the transform to the document tree.

default_priority = 250
class ipypublish.sphinx.notebook.transforms.CreateNotebookSectionAnchors(document, startnode=None)[source]

Bases: docutils.transforms.Transform

Create section anchors for Jupyter notebooks.

Note: Sphinx lower-cases the HTML section IDs, Jupyter doesn’t. This transform creates anchors in the Jupyter style.

# TODO do this in pandoc filter?

apply()[source]

Override to apply the transform to the document tree.

default_priority = 200
class ipypublish.sphinx.notebook.transforms.CreateSectionLabels(document, startnode=None)[source]

Bases: docutils.transforms.Transform

Make labels for each document and each section thereof.

These labels are referenced in RewriteLocalLinks but can also be used manually with :ref:.

apply()[source]

Override to apply the transform to the document tree.

default_priority = 250

Bases: docutils.transforms.Transform

Turn links to source files into :doc:/:ref: links.

Links to subsections are possible with ...#Subsection-Title. These links use the labels created by CreateSectionLabels.

Links to subsections use :ref:, links to whole source files use :doc:. Latter can be useful if you have an index.rst but also want a distinct index.ipynb for use with Jupyter. In this case you can use such a link in a notebook:

[Back to main page](index.ipynb)

In Jupyter, this will create a “normal” link to index.ipynb, but in the files generated by Sphinx, this will become a link to the main page created from index.rst.

apply()[source]

Override to apply the transform to the document tree.

default_priority = 500