sphinx-prompt
Sphinx directive to add unselectable prompt
What it is and what it does
Sphinx Prompt is a Sphinx extension that adds a `prompt` directive for rendering command-line and code prompts in documentation. It supports multiple languages—bash, batch, PowerShell, Python, Scala, and plain text—and allows you to customize the prompt string, language syntax highlighting, and prompt detection behavior. The rendered prompts are unselectable, making them suitable for copy-paste-friendly documentation where you want users to see the prompt but not accidentally select it.
You install it by adding `sphinx_prompt` to your Sphinx `conf.py` extensions list, then use the `.. prompt::` directive in your reStructuredText files. The directive accepts language as a positional argument and supports options like `:prompts:` to specify custom prompt strings and `:modifiers:` to control prompt detection. It depends on standard Sphinx and documentation libraries (docutils, Jinja2, Pygments) and requires Python 3.11 or later.
Use it for:
- Document shell commands and their expected output in installation or setup guides with styled, unselectable prompts.
- Render Python REPL sessions with >>> prompts in tutorial documentation.
- Create PowerShell or batch script examples in Windows-focused documentation.
- Highlight multiple command-line prompts in a single code block for complex shell workflows.
- Maintain consistent prompt styling across large documentation projects using Sphinx.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Sphinx Prompt is a Sphinx extension that renders shell and code prompts in documentation as unselectable, styled text blocks for multiple languages including bash, Python, PowerShell, and batch.
Yes. This is a stable, actively maintained Sphinx extension with no known vulnerabilities, permissive licensing, and low install friction. It solves a specific documentation problem—rendering unselectable prompts—cleanly and integrates naturally into Sphinx workflows. Install it if you document shell commands or code examples in Sphinx and want styled, user-friendly prompts.
Install
sphinx-prompt on PyPI
pip
pip install sphinx-promptuv
uv add sphinx-promptpoetry
poetry add sphinx-promptInstalling sphinx-prompt
Before you install
Low install friction with a pure-Python wheel distribution. The package is actively maintained with a recent release and remains current, depending on standard Sphinx and documentation tooling libraries.
License in practice
BSD-3-Clause is a permissive license allowing commercial and private use with minimal restrictions, making this safe to use in most projects.
Quickstart
# In conf.py
extensions += ['sphinx_prompt']
# In your .rst file
.. prompt:: bash
:prompts: $
python3 -m pip install sphinx-prompt
Requires Python >= 3.11 and an existing Sphinx documentation project.
Verify before relying
- Whether the package supports reStructuredText syntax beyond the documented languages (text, bash, batch, powershell, python, scala).
- Performance characteristics when rendering large numbers of prompts in a single documentation build.
Package facts
| License | BSD-3-Clause (permissive) |
| Python support | supports the current Python release (>=3.11) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 8 — Sphinx, certifi, docutils, idna, jinja2, pygments, requests, urllib3 |
| Maintenance | actively maintained — 259 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 924,747/month — #4,712 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: sphinx_prompt-1.10.2-py3-none-any.whl
Keywords: sphinx, shell, prompt
Tags
More Documentation packages
Docutils converts plaintext documentation in…
unclear · top 1,000 on PyPI
SphinxSphinx generates professional documentation…
permissive · top 1,000 on PyPI
griffeGriffe extracts the complete structure and…
permissive · top 1,000 on PyPI
sphinxcontrib-serializinghtmlA Sphinx extension that outputs documentation…
permissive · top 1,000 on PyPI
alabasterAlabaster is a clean, responsive Sphinx theme…
permissive · top 1,000 on PyPI
sphinxcontrib-htmlhelpA Sphinx extension that generates HTML help…
permissive · top 1,000 on PyPI
sphinxcontrib-runcmdA Sphinx extension that executes arbitrary…
permissive · top 15,000 on PyPI
sphinx-togglepromptAdds a button to Python code blocks in Sphinx…
permissive · top 15,000 on PyPI
sphinx-panelsA Sphinx extension that adds directives for…
permissive · top 15,000 on PyPI
sphinxcontrib-programoutputA Sphinx extension that executes arbitrary…
permissive · top 15,000 on PyPI
sphinxcontrib-typerA Sphinx extension that auto-generates…
permissive · top 15,000 on PyPI
prompthub-pyFetches prompt templates from Prompt Hub or…
permissive · top 15,000 on PyPI
sphinx-plotly-directiveAdds a Sphinx directive to embed interactive…
unclear · top 15,000 on PyPI
questoQuesto provides modular, extensible CLI prompt…
permissive · top 15,000 on PyPI
sphinx-substitution-extensionsAdds substitution support to Sphinx directives,…
permissive · top 15,000 on PyPI
sphinx-jinjaA Sphinx extension that lets you embed Jinja2…
permissive · top 5,000 on PyPI