Extensions for Sphinx which allow substitutions.
Contents
$ pip install Sphinx-Substitution-Extensions
This supports Python 3.8+.
- Add the following to
conf.py
:
extensions += ['sphinx-prompt', 'sphinx_substitution_extensions']
- Set the following variable in
conf.py
:
substitutions = [
('|release|', '0.1'),
('|author|', 'Eleanor'),
]
This will replace |release|
in the new directives with 0.1
, and |author|
with Eleanor
.
.. substitution-code-block:: bash
echo "|author| released version |release|"
This is an extension of Sphinx's built-in code-block directive, and adds replacement functionality.
.. substitution-prompt:: bash
echo "|author| released version |release|"
This is an extension of sphinx-prompt.
substitution-prompt
acts similarly to sphinx-prompt, and adds replacement functionality.
:substitution-code:`echo "|author| released version |release|"`
Thanks to @sbrunner and other contributors for sphinx-prompt.
substitution-prompt
is based on sphinx-prompt.
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.
See CONTRIBUTING.rst.