Skip to main content
Join the official 2020 Python Developers SurveyStart the survey!

Extensions for Sphinx which allow for substitutions.

Project description

Build Status codecov PyPI

Sphinx Substitution Extensions

Extensions for Sphinx which allow substitutions.

Installation

$ pip install Sphinx-Substitution-Extensions

This supports Python 3.8+.

Setup

  • Add the following to conf.py:
# sphinx-prompt must be the first of these two.
extensions += ['sphinx-prompt', 'sphinx_substitution_extensions']
  • Set the following variable in conf.py:
rst_prolog = """
.. |release| replace:: 0.1
.. |author| replace:: Eleanor
"""

This will replace |release| in the new directives with 0.1, and |author| with Eleanor.

Directives

code-block

This adds a :substitutions: option to Sphinx’s built-in code-block directive.

.. code-block:: bash
   :substitutions:

   echo "|author| released version |release|"

prompt

This adds a :substitutions: option to sphinx-prompt.

.. prompt:: bash
   :substitutions:

   echo "|author| released version |release|"

Inline :substitution-code:

:substitution-code:`echo "|author| released version |release|"`

Credits

sphinx-prompt authors

Thanks to @sbrunner and other contributors for sphinx-prompt. substitution-prompt is based on sphinx-prompt.

ClusterHQ Developers

This package is largely inspired by code written for Flocker by ClusterHQ. Developers of the relevant code include, at least, Jon Giddy and Tom Prince.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for Sphinx-Substitution-Extensions, version 2020.9.30.0
Filename, size File type Python version Upload date Hashes
Filename, size Sphinx_Substitution_Extensions-2020.9.30.0-py3-none-any.whl (8.4 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size Sphinx Substitution Extensions-2020.9.30.0.tar.gz (19.1 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page