Extensions for Sphinx which allow for substitutions.
Project description
Sphinx Substitution Extensions
Extensions for Sphinx which allow substitutions within code blocks.
Installation
Sphinx Substitution Extensions is compatible with Sphinx 4.0+ using Python 3.10+.
$ pip install Sphinx-Substitution-Extensions
Setup
Add the following to conf.py:
extensions += ['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
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.
Contributing
See CONTRIBUTING.rst.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file sphinx-substitution-extensions-2024.2.24.tar.gz
.
File metadata
- Download URL: sphinx-substitution-extensions-2024.2.24.tar.gz
- Upload date:
- Size: 23.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5307da69078ceb81e6f825c2dbd7d3afe2e2ae945bf108952d1335020436e38e |
|
MD5 | dd888bca2b475f385cd5b763c1c26337 |
|
BLAKE2b-256 | 58cddb5d9f4e92d2ddc6d37a83dfb4e9a5469a3c4e7705dea42f7be6c7a39e15 |
File details
Details for the file sphinx_substitution_extensions-2024.2.24-py2.py3-none-any.whl
.
File metadata
- Download URL: sphinx_substitution_extensions-2024.2.24-py2.py3-none-any.whl
- Upload date:
- Size: 13.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | da00244e62515517534210882807debf312c23693fb5f4d6fddffc94c45f9449 |
|
MD5 | 864de80919f87ab63a24ef64bc22f48e |
|
BLAKE2b-256 | 2a28db63690db397cffb8c3563ff84b298e8f3b04b19c2c9f2e4f5606be9c79c |