So I'm trying to use sphinx to build some python documentation. I have an extension (https://github.com/lunaryorn/sphinxcontrib-programoutput) that I'm using to call one of my source python files to show the usage text such as .. command-output:: python ../src/something.py --help
which works fine, the issue is that I want to color code the output.
I've tried putting a .. code-block:: sh
on top of it but I can't figure out if there is actually a way to nest the two like that.
Is this possible at all?
Edit: More Information
So here is part of my rst source file:
..command-output:: python ../project/module.py --help
This will end up creating html like so:
<div class="highlight-text notranslate">
<div class="highlight">
<pre>
<span></span>
$ python ../project/module.py --help
usage: module.py [-h][-d | -q]
This is a project
optional arguments:
-h, --help show this help message and exit
logging arguments:
Control what log level the log outputs (default: logger.INFO)
-d, --debug Set log level to DEBUG for more verbose output
-q, --quiet Suppress all logs except ERROR and CRITICAL
</pre>
</div>
</div>
The problem here is that the usage output is just straight black and white, but I would like it to be syntax highlighted as if it were shell code, or any other language (as this command-output thing might be used for other kinds of output).
As noted below https://stackoverflow.com/users/2214933/steve-piercy notes that .. code-block::
can not have another directive nested underneath it, which is something I tried to get working. So what I'm looking for would be to somehow be able to colour the output of command-output
as if it were being modified by a .. code-block::
directive.