[OpenStack-docs] Better way to display shell commands

Adrien Cunin adrien at adriencunin.fr
Tue Jul 5 08:43:00 UTC 2016


Hi,

From what I can see we usually use

  .. code-block:: console

or

  .. code-block:: shell-session

(which actually are the same)

to show commands that are to be executed by the user such as

  # apt-get install foo
  # echo 1 > bar

The main issue, and the reason I started looking into this, is that the
html output doesn't make it easy to select commands (for copy/pasting
typically) without the prompt.

Turns out there is a Sphinx extension to do just this:
https://github.com/sbrunner/sphinx-prompt

With this extension, the following

  .. prompt:: bash #

     apt-get install foo
     echo 1 > bar

will have the expected result.
That is: looks similar to the previous version, but one can easily
select commands without the prompt.

Does it sound like a good idea?

We'd need first to enable the Sphinx extension wherever we use Sphinx.
Does that actually require to patch each git repository that contains
documentation or do we have another way of doing it globally?
Then, documentations should start using ".. prompt:: bash" instead of
".. code-block:: console" when appropriate - the change could be
automated or not.

Adrien

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.openstack.org/pipermail/openstack-docs/attachments/20160705/0655a19e/attachment.pgp>


More information about the OpenStack-docs mailing list