Skip to main content

A Sphinx extension for rendering terminal input and output.

Project description

sphinx-terminal

sphinx-terminal allows you to display terminal input and output in your Sphinx documentation.

Basic usage

To display terminal input and output in your rST document, use the terminal directive, providing input and output as follows:

.. terminal::
    :input: echo 'hello'

        hello
    :input: echo 'goodbye'

        goodbye

The prompt defaults to user@host:~$. To customize this, use the :user:, :host:, and :dir: options.

.. terminal::
    :user: author
    :host: canonical
    :dir: ~/path
    :input: echo 'hello'

        hello

To enable a copy button for users, include the :copy: flag as a directive option.

.. terminal::
    :copy:
    :input: echo 'hello'

        hello

Similarly, to make the output scrollable, include the :scroll: flag as a directive option.

.. terminal::
    :scroll:
    :input: echo 'hello'

        hello

Project setup

sphinx-terminal is published on PyPI and can be installed with:

pip install sphinx-terminal

After adding sphinx-terminal to your Python project, update your Sphinx's conf.py file to include hello-ext as one of its extensions:

extensions = [
    "sphinx_terminal"
]

Community and support

You can report any issues or bugs on the project's GitHub repository.

sphinx-terminal is covered by the Ubuntu Code of Conduct.

License and copyright

sphinx-terminal is released under the GPL-3.0 license.

© 2025 Canonical Ltd.

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_terminal-0.0.1.tar.gz (76.3 kB view details)

Uploaded Source

Built Distribution

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

sphinx_terminal-0.0.1-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file sphinx_terminal-0.0.1.tar.gz.

File metadata

  • Download URL: sphinx_terminal-0.0.1.tar.gz
  • Upload date:
  • Size: 76.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for sphinx_terminal-0.0.1.tar.gz
Algorithm Hash digest
SHA256 c5ae0d7d38614ffe95a380c4c037ff144d892b56878f842e675489e58fba0ca9
MD5 5a6d2270aee7a7be5bb063d40fc8cb47
BLAKE2b-256 a863e5c009dcf1f4dcaf8a1f493424ddd6c978968c829729a292e9bc554461f3

See more details on using hashes here.

Provenance

The following attestation bundles were made for sphinx_terminal-0.0.1.tar.gz:

Publisher: release-publish.yaml on canonical/sphinx-terminal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sphinx_terminal-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for sphinx_terminal-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 62fa2d1fc18b6a9a16e361965a2e2f3dc5358333d26e9811696e315d0e130780
MD5 90554c932736719ffba0d23ac296d878
BLAKE2b-256 72c4b31f9ce5daf502e407a631fbf16403094d89a6db4aea5871823e3a9d419b

See more details on using hashes here.

Provenance

The following attestation bundles were made for sphinx_terminal-0.0.1-py3-none-any.whl:

Publisher: release-publish.yaml on canonical/sphinx-terminal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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