magics

Document magics using the magic directive.

parse_magic(env, sig, signode)[source][source]

Extend Sphinx to handle IPython magics.

Parameters

env – Genuinely unsure what any of these parameters are.

Raises

IPython.core.error.UsageError – Raised when regular expression re.compile(r"[\w_]+") doesn’t match the signature of interest.

class LineMagicRole(fix_parens: bool = False, lowercase: bool = False, nodeclass: Type[Element] = None, innernodeclass: Type[TextElement] = None, warn_dangling: bool = False)[source][source]

Bases: sphinx.roles.XRefRole

Cross reference role displayed with a % prefix.

prefix = '%'[source]

Generate a link without the leading % in it.

parse_cell_magic(env, sig, signode)[source][source]

Read rst documents and check for %%.

class CellMagicRole(fix_parens: bool = False, lowercase: bool = False, nodeclass: Type[Element] = None, innernodeclass: Type[TextElement] = None, warn_dangling: bool = False)[source][source]

Bases: default_profile.sphinxext.magics.LineMagicRole

Cross reference role displayed with a %% prefix.

prefix = '%%'[source]
setup(app)[source][source]
setup(app)[source][source]

The standard setup function in all sphinx extensions. Adds 2 roles in linemagic and cellmagic as well as the magic role.

See Also

IPython’s sphinx extension for magics.

https://github.com/ipython/ipython/blob/master/docs/sphinxext/magics.py