Sphinx Prompt¶
Note
This page was Retrieved and copied April 7 2021
https://github.com/sbrunner/sphinx-prompt/blob/master/README.rst
Table of contents
Initialise¶
In conf.py
add extensions += ['sphinx-prompt']
.
Syntax¶
A default prompt can be created using a prompt
directive:
MUST have a blank line following the directive
.. prompt::
<statements>
no prompt language specified: (so default is text)
<statements>
bash prompt:
<statements>
python 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
Run tests and prospector¶
python3 -m pip install --user --upgrade pipenv
pipenv sync --dev
pipenv run pytest
pipenv run prospector
The code should be formatted with black
add isort
.
Last change: Tue, 03 Aug 2021 10:25 PM UTC