RST: how to present the output of the `tree` command?

I would like to present the output of a command treein a Restructured Text document. I am using this code:

.. code-block:: bash

   project
   β”œβ”€β”€ demo.py
   β”œβ”€β”€ LICENCE.txt
   β”œβ”€β”€ processes          
   β”‚   β”œβ”€β”€ area.py
   β”‚   └── bboxinout.py
   β”œβ”€β”€ pywps.cfg          
   β”œβ”€β”€ requirements.txt
   β”œβ”€β”€ server.py          
   β”œβ”€β”€ setup.py
   β”œβ”€β”€ static
   β”œβ”€β”€ templates
   └── tests

Which produces the following output:

enter image description here

Then I tried replacing the characters treewith unicode definitions, for example:

.. |hbar| unicode:: 01C0 ..

But the sequence |hbar|is printed verbatim when used inside a code block.

Is there any other way to force these characters to be printed?

+4
source share
2 answers

In ReST, I use literals to represent tree structures:

::

    project
    β”œβ”€β”€ demo.py
    β”œβ”€β”€ LICENCE.txt
    β”œβ”€β”€ processes          
    β”‚   β”œβ”€β”€ area.py
    β”‚   └── bboxinout.py
    β”œβ”€β”€ pywps.cfg          
    β”œβ”€β”€ requirements.txt
    β”œβ”€β”€ server.py          
    β”œβ”€β”€ setup.py
    β”œβ”€β”€ static
    β”œβ”€β”€ templates
    └── tests

Hope this helps!

+4
source

, , , , "|" :

| project
| β”œβ”€β”€ demo.py
| β”œβ”€β”€ LICENCE.txt
| β”œβ”€β”€ processes          
| β”‚   β”œβ”€β”€ area.py
| β”‚   └── bboxinout.py
| β”œβ”€β”€ pywps.cfg          
| β”œβ”€β”€ requirements.txt
| β”œβ”€β”€ server.py          
| β”œβ”€β”€ setup.py
| β”œβ”€β”€ static
| β”œβ”€β”€ templates
| └── tests

html, - :

enter image description here

, , .

, .

0

All Articles