Skip to main content

Sphinx directive to add unselectable prompt

Project description

Sphinx Prompt


In add extensions += ['sphinx_prompt'].


A default prompt can be created using a prompt directive:

.. prompt::


The prompt can be further customized in one of two ways:

  • Using positional arguments:

    .. prompt:: [<language> [<prompts> [<modifiers>]]]
  • Using options:

    .. prompt::
        :language: <language>
        :prompts: <prompts>
        :modifiers: <modifiers>

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


Supported language:

  • text (no pigments, default)
  • bash
  • batch
  • powershell
  • python
  • scala


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:\>



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>


Install the pre-commit hooks:

pip install pre-commit
pre-commit install --allow-missing-config

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sphinx_prompt-1.8.0.tar.gz (5.1 kB view hashes)

Uploaded source

Built Distribution

sphinx_prompt-1.8.0-py3-none-any.whl (7.3 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page