[OpenStack-docs] italicized python cmds, literal blocks

Gauvain Pocentek gauvain.pocentek at objectif-libre.com
Mon Jun 29 20:33:33 UTC 2015


Le 2015-06-29 22:12, Karen Bradshaw a écrit :
> Hi.  I have been looking into the use of :: vs .. code-block::
> in the newly converted RST guides.  I have found some 
> inconsistencies. 
> I found that using a root-privileged python executable with the pound 
> sign, gets
> 
> formatted like a python comment (italicized).  
> If there is output shown after the command
> then the cmd and output are not italicized but treated as literal
> text; the single colon directive is used in this case.  
> Using the dollar prompt, everything works as expected (not 
> italicized).
> We use the literal block directive, double colon, throughout the RST 
> guides.
> One way I found to get around this is to always use the dollar prompt.
> Another way is .. code-block::java.  It is a hack, but it generates 
> the correct
> output for the pound sign <python cmd>.
> May be someone can shed some light on this problem.

You probably want to use '.. code-block:: console' for interactive 
shell sessions (a prompt and a command followed by its output). This 
will show a different color for the prompt and for shell builtin 
commands.

If I'm not mistaken :: always uses python syntax highlighting (so 
italic after a # sign is normal behavior), unless you specified another 
lexer to use in your document.

Gauvain Pocentek

Objectif Libre - Infrastructure et Formations Linux
http://www.objectif-libre.com



More information about the OpenStack-docs mailing list