Skip to main content

Sphinx directive to add unselectable prompt

Project description

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>

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.6.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sphinx_prompt-1.6.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file sphinx_prompt-1.6.0.tar.gz.

File metadata

  • Download URL: sphinx_prompt-1.6.0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for sphinx_prompt-1.6.0.tar.gz
Algorithm Hash digest
SHA256 0ae92cdae0962896827e11880d3e2317b436491663e83a8289a9c9c1b7d758ae
MD5 ad2ceeb8fcd4802c1330a5efe8468b00
BLAKE2b-256 d0fba252124876be4e2eb2a25536c76e817e10d96ecd47b971016b960cb8d726

See more details on using hashes here.

File details

Details for the file sphinx_prompt-1.6.0-py3-none-any.whl.

File metadata

  • Download URL: sphinx_prompt-1.6.0-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for sphinx_prompt-1.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a118fc1519f367dfffd73fbc34e1d905e38929dec6a3971518a331bf0689b0df
MD5 0d56ac257f4c0156e0c8dfea4e2e14ba
BLAKE2b-256 1125a9252d0ccf84247b602a47cbe1ec6669647971841594ee8a1ed38b7b1c38

See more details on using hashes here.

Supported by

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