-
Notifications
You must be signed in to change notification settings - Fork 11
Description
The canonical starter pack auto-enables an extension called terminal-output:
Lines 218 to 236 in 4b49500
| # NOTE: The canonical_sphinx extension is required for the starter pack. | |
| # It automatically enables the following extensions: | |
| # - custom-rst-roles | |
| # - myst_parser | |
| # - notfound.extension | |
| # - related-links | |
| # - sphinx_copybutton | |
| # - sphinx_design | |
| # - sphinx_reredirects | |
| # - sphinx_tabs.tabs | |
| # - sphinxcontrib.jquery | |
| # - sphinxext.opengraph | |
| # - terminal-output | |
| # - youtube-links | |
| extensions = [ | |
| "canonical_sphinx", | |
| "sphinxcontrib.cairosvgconverter", | |
| ] |
Here's how it works (from https://github.com/canonical/canonical-sphinx-extensions?tab=readme-ov-file#terminal-output):
Single command sample:
:input: single command :user: root :host: vm :dir: /tmp/dir/ output line one output line twoMultiple command sample:
:user: root :host: vm :dir: /tmp/dir/ :input: a command output line one output line two :input: another command more output
The output is rendered like this (screenshot) (built in this repo):

Currently, I tend to use simple code blocks to specify terminal commands. I'm wondering if I should switch to using this instead?
It has a different aesthetic, but also clearly shows the CWD, which is helpful in tutorials when I ask the user to cd in and out of various directories. However, it appears that the extension does not have a "copy" button to easily copy the commands, which is definitely a downside.
Also, the inclusion of the command-line prompt appears to violate the Canonical Documentation Style Guide.
I could see this being beneficial in my tutorial, since I can paste the entire output of a command (apparently there is an option to make the output scrollable so it doesn't take up too much space on the page), which may help users better understand if their output matches the expected output of a command.
Should I use this terminal-output extension, normal markdown code blocks, or something else? Any advice about this would be greatly appreciated, thanks!