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.XRefRoleCross reference role displayed with a % prefix.
-
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.LineMagicRoleCross reference role displayed with a %% prefix.
-
setup(app)[source][source] The standard setup function in all sphinx extensions. Adds 2 roles in linemagic and cellmagic as well as the
magicrole.
See Also¶
- IPython’s sphinx extension for magics.
https://github.com/ipython/ipython/blob/master/docs/sphinxext/magics.py