With HTML and CSS, there are several ways to add an image to an element that produces different results. A couple I can think of is:
Use an image instead of any text. Here we save the text, but send it from the screen, so it is still available.
h1 { background: url(images/image.jpg) no-repeat top center; display: block; text-indent: 100%; white-space: nowrap; overflow: hidden; width: XXpx; height: XXpx; }
Place the image to the left of the text (or can be easily right)
h1 { background: url(images/image.jpg) no-repeat top left; padding-left: XXpx; }
Use a background image, behind any text
h1 { background:url(images/image.jpg) no-repeat top center; }
More specific CSS selectors can only be used to target specific headers.
You can easily add custom CSS to reStructuredText documents using the raw directive , for example:
.. raw:: html <style> </style>
Alternatively, you can include your own CSS style sheets from the command line using the --stylesheet rst2html.py option.
In terms of achieving this with the release in PDF, I will steal part of another of my answer :
Obviously, the above goals output HTML. However, I did not use rst2pdf, so I can not comment on how you need to change this to work with this program. Hope someone else answers this. As far as I know, rst2pdf supports a cascading style sheet mechanism , so it should be simple (for those who know the rst2pdf style sheet syntax) to add an extra role .. raw:: pdf and change the list styles specified.
Chris source share