Sphinx directive to add unselectable prompt
Project description
Sphinx Prompt
Initialize
In conf.py
add extensions += ['sphinx_prompt']
.
Syntax
A default prompt can be created using a prompt
directive:
.. prompt::
<statements>
The prompt can be further customized in one of two ways:
-
Using positional arguments:
.. prompt:: [<language> [<prompts> [<modifiers>]]] <statements>
-
Using options:
.. prompt:: :language: <language> :prompts: <prompts> :modifiers: <modifiers> <statements>
While these constructs generate the same output, the positional arguments cannot be used if you want to use a prompt that contains spaces. This is a limitation of reStructuredText.
Positional arguments can be mixed with options if they don't overlap (so if you pass prompts using options, you can only pass the language using positional arguments):
.. prompt:: bash
:prompts: (cool_project) $
python3 -m pip install --upgrade sphinx-prompt
Language
Supported language:
text
(no pigments, default)bash
batch
powershell
python
scala
Prompt(s)
If modifier is auto, a comma-separated list of prompts to find in the statements.
Else the prompt to add on each statements, for Python and Bash language
the end \
is supported.
Defaults to empty, except for the shell languages listed below:
bash
-$
batch
-C:\>
powershell
-PS C:\>
Examples
See: http://sbrunner.github.io/sphinx-prompt/
Run tests and prospector
python3 -m pip install --user --upgrade poetry
poetry install
poetry run pytest
poetry run prospector
The code should be formatted with black
add isort
.
Create new release
git tag <version>
git push origin <version>
Contributing
Install the pre-commit hooks:
pip install pre-commit
pre-commit install --allow-missing-config
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_prompt-1.9.0.tar.gz
.
File metadata
- Download URL: sphinx_prompt-1.9.0.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 471b3c6d466dce780a9b167d9541865fd4e9a80ed46e31b06a52a0529ae995a1 |
|
MD5 | 6f8924cb64c87692974d29fbef2a254d |
|
BLAKE2b-256 | 34feac4e24f35b5148b31ac717ae7dcc7a2f7ec56eb729e22c7252ed8ad2d9a5 |
File details
Details for the file sphinx_prompt-1.9.0-py3-none-any.whl
.
File metadata
- Download URL: sphinx_prompt-1.9.0-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd731446c03f043d1ff6df9f22414495b23067c67011cc21658ea8d36b3575fc |
|
MD5 | ff01f7158a91e127e93a92a6eb93e6f4 |
|
BLAKE2b-256 | 7698e90ca466e0ede452d3e5a8d92b8fb68db6de269856e019ed9cab69440522 |