skillfed

sphinx-prompt

Sphinx directive to add unselectable prompt

sphinx-prompt v1.10.2 924.7K downloads/30d#4,712 on PyPI52
Permissive license BSD-3-Clause Active released

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-prompt

uv

uv add sphinx-prompt

poetry

poetry add sphinx-prompt

Installing 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

Development Status :: 5 - Production/StableEnvironment :: PluginsEnvironment :: Web EnvironmentFramework :: Sphinx :: ExtensionIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Topic :: DocumentationTopic :: Documentation :: SphinxTopic :: Software Development :: DocumentationTyping :: Typed

Tags

sphinx shell prompt directivecode prompt rendering sphinxbash prompt documentationsphinx code block stylingunselectable prompt sphinxshell command documentationsphinx language prompts
sphinx-extensiondocumentation-tooling

More Documentation packages

docutils

Docutils converts plaintext documentation in…

unclear · top 1,000 on PyPI

Sphinx

Sphinx generates professional documentation…

permissive · top 1,000 on PyPI

griffe

Griffe extracts the complete structure and…

permissive · top 1,000 on PyPI

sphinxcontrib-serializinghtml

A Sphinx extension that outputs documentation…

permissive · top 1,000 on PyPI

alabaster

Alabaster is a clean, responsive Sphinx theme…

permissive · top 1,000 on PyPI

sphinxcontrib-htmlhelp

A Sphinx extension that generates HTML help…

permissive · top 1,000 on PyPI

sphinxcontrib-runcmd

A Sphinx extension that executes arbitrary…

permissive · top 15,000 on PyPI

sphinx-toggleprompt

Adds a button to Python code blocks in Sphinx…

permissive · top 15,000 on PyPI

sphinx-panels

A Sphinx extension that adds directives for…

permissive · top 15,000 on PyPI

sphinxcontrib-programoutput

A Sphinx extension that executes arbitrary…

permissive · top 15,000 on PyPI

sphinxcontrib-typer

A Sphinx extension that auto-generates…

permissive · top 15,000 on PyPI

prompthub-py

Fetches prompt templates from Prompt Hub or…

permissive · top 15,000 on PyPI

sphinx-plotly-directive

Adds a Sphinx directive to embed interactive…

unclear · top 15,000 on PyPI

questo

Questo provides modular, extensible CLI prompt…

permissive · top 15,000 on PyPI

sphinx-substitution-extensions

Adds substitution support to Sphinx directives,…

permissive · top 15,000 on PyPI

sphinx-jinja

A Sphinx extension that lets you embed Jinja2…

permissive · top 5,000 on PyPI