formatting

Directives, roles and nodes for text formatting.

New in version 0.2.0.

Enable sphinx_toolbox.formatting by adding the following to the extensions variable in your conf.py:

extensions = [
    ...
    'sphinx_toolbox.formatting',
    ]

For more information see https://www.sphinx-doc.org/en/master/usage/extensions#third-party-extensions .

Usage

:iabbr:

An abbreviation. If the role content contains a parenthesized explanation, it will be treated specially: it will be shown in a tool-tip in HTML, and output only once in LaTeX.

Unlike Sphinx’s abbr role, this one shows the abbreviation in italics.

New in version 0.2.0.

Example

:iabbr:`LIFO (last-in, first-out)`

LIFO

:bold-title:

Role for displaying a pseudo title in bold.

This is useful for breaking up Python docstrings.

New in version 2.12.0.

Example

:bold-title:`Examples:`

:bold-title:`Other Extensions`

Examples:

Other Extensions

API Reference

Classes:

ItalicAbbreviationNode([rawsource, text])

Docutils Node to show an abbreviation in italics.

ItalicAbbreviation()

Docutils role to show an abbreviation in italics.

Functions:

visit_iabbr_node(translator, node)

Visit an ItalicAbbreviationNode.

depart_iabbr_node(translator, node)

Depart an ItalicAbbreviationNode.

latex_visit_iabbr_node(translator, node)

Visit an ItalicAbbreviationNode.

latex_depart_iabbr_node(translator, node)

Depart an ItalicAbbreviationNode.

setup(app)

Setup sphinx_toolbox.formatting.

class ItalicAbbreviationNode(rawsource='', text='', *children, **attributes)[source]

Bases: abbreviation

Docutils Node to show an abbreviation in italics.

class ItalicAbbreviation[source]

Bases: Abbreviation

Docutils role to show an abbreviation in italics.

Methods:

run()

Process the content of the italic abbreviation role.

run()[source]

Process the content of the italic abbreviation role.

Return type

Tuple[List[Node], List[system_message]]

visit_iabbr_node(translator, node)[source]

Visit an ItalicAbbreviationNode.

Parameters
depart_iabbr_node(translator, node)[source]

Depart an ItalicAbbreviationNode.

Parameters
latex_visit_iabbr_node(translator, node)[source]

Visit an ItalicAbbreviationNode.

Parameters
latex_depart_iabbr_node(translator, node)[source]

Depart an ItalicAbbreviationNode.

Parameters
setup(app)[source]

Setup sphinx_toolbox.formatting.

Parameters

app (Sphinx) – The Sphinx application.

Return type

SphinxExtMetadata