Re: how to present commandline output

Guenter Milde via Docutils-users <[email protected]>
Newsgroups gmane.text.docutils.user
Message-ID <[email protected]>
On 2018-08-09, Glyn Davies wrote:

> Hi Folks,

> I am looking for a a way to include linux commandline output into my
> RST/Sphinx documentation.

> The issue is with random indentation and line length and while I can
> trim the lines it spoils the readability of the output and removing the
> indentation completely screws the context. Below is an example of the
> kind of thing I would like to include if possible.

The usual way to do this would be a `literal block`__. If the content resides
in an external file, use `include`__ with the "literal" option.
This keeps the formatting as-is and uses a fixed-width font.

As a downside, you will evt. see very long lines (overrunning the page in
LaTeX output, requiring scrolling in HTML). If this is a one-off, you
could manually break overfull lines in the rST source. In HTML, you may
solve this via CSS (separate side-scrolling for a fixed-width
literal-block element).

__ http://docutils.sf.net/docs/user/rst/quickref.html#literal-blocks
__ http://docutils.sf.net/docs/ref/rst/directives.html#including-an-external-document-fragment

`Class arguments`__ may be used to scale down the font size of blocks
with too long lines.

http://docutils.sf.net/docs/ref/rst/directives.html#class

Your example contains line breaks that are probably from the terminal. Maybe
using a full-screen terminal to capture the output helps.


Hope this gets you started,

Günter


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Docutils-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/docutils-users

Please use "Reply All" to reply to the list.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.