This is a followup of "ReST Strikethrough" ReST strikethrough but in a Sphinx rather than ReST context. My question is whether there is a central place in sphinx where to put a "role" directive or whether this directive really has to be repeated in every rst file within a sphinx docmentation.
In more detail:
It is easy to define custom CSS styles for inline text (see ReST Strikethrough as example) using a role directive:
.. role:: custom
:class: custom
This is an :custom:`inline text`.
which translates into a html rendering of
.. This is an <span class="custom">inline text</span>. ..
Also, a custom stylesheet can easily be added to sphinx (see http://www.tinkerer.me/doc/theming.html) where to add a CSS class selector to control how "custom" text is rendered (color, strikethrough, font, size...)
What disturbes me is that in my experiments, I had to repeat the role directive in every ReST file that used the custom role. Is there a "central" place where I can define this once for the whole site?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…