How can I use color with ReStructured Text? For example, **hello**
translates into hello
. How can I make ReStructure(r
Combining @prosseek's and @RayLuo's answers all in one place - to make easier to find
At the top of your RST file, place
.. raw:: html
<style> .red {color:red} </style>
.. role:: red
:red:`test - this text should be red`
SIDE COMMENT:
Of course, many folks will want the style in a separate file, as @sienkiew says.
But not always.
E.g. I am generating the above from a script that I want other users to be able to run, often from a file URL. Depending on rst2html.py is bad enough - requiring something nonstandard to be in a config file is worse.
If there were a way to create a weak local definition for the style - e.g. "if there is no style .red already defined use this, but otherwise use the style already defined" - would be nice. But AFAIK local definitions are stronger.
This ran with rst2html.py (Docutils 0.13.1 [release], Python 3.6.4, on cygwin)
, but other RST tools rejected.