Dynamically generated content for sphinx documentations
Project description
sphinxcontrib-run
sphinxcontrib-run registers a new .. run:: directive to execute code dynamically while building a sphinx documentation.
It can be used to generate documentation artifacts such as figures or to insert dynamic content.
Example:
"""
.. run::
from example import square_text_50
lorem = (
"Lorem ipsum dolor sit amet, consectetur adipiscing elit."
+ " Pellentesque faucibus vestibulum est id consequat."
+ " Cras sed enim sed ex maximus blandit."
)
"""
def square_text_50(text):
"""Wrap text to 40 columns.
.. run::
print("::")
print("")
for line in square_text_50(lorem):
print(" " + line)
print("")
"""
for i in range(0, len(text), 50):
yield text[i : i + 50]
renders as:
Note: The environement persists across calls within the scope of a document.
Installation
Install the package:
pip install sphinxcontrib-run
Then add the extension to the sphinx configuration:
extensions = [
...
"sphinxcontrib.run"
]
Documentation
The documentation is hosted at: https://sphinxcontrib-run.readthedocs.io/en/latest/
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sphinxcontrib_run-0.3.0.tar.gz.
File metadata
- Download URL: sphinxcontrib_run-0.3.0.tar.gz
- Upload date:
- Size: 47.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
645e725975d2dbf677e53e865382959e16da8360356957206b9803bd4e9ba0cd
|
|
| MD5 |
119a4108766b4b3990045b0755cca004
|
|
| BLAKE2b-256 |
54cf5e41d768cedd2188a378ccf93c3f0aeb8a7f0d0379faec97294fbecfa991
|
File details
Details for the file sphinxcontrib_run-0.3.0-py3-none-any.whl.
File metadata
- Download URL: sphinxcontrib_run-0.3.0-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8680857184606633f8c2bb24563c9206e566211240873896941f163896e77b35
|
|
| MD5 |
dc7318fb44171d4053b2075a1a9c2540
|
|
| BLAKE2b-256 |
c56c3983bcf15c2e2fc503d1b89ba7be50671e5a877880e5f26b7ffefdbad42f
|