Hi there!

I'm new to sphinx and trying to slowly find my way …
My task is to write some software documentation (manuals, how-tos, 
tutorials) and for the time being, I have chosen the *sphinxdoc *theme. 
Output will be HTML.
In the documentation, I'm referring to a lot of files (file names) and code 
objects such as classes, functions, constants, enums, variables etc.
Clearly, I'm using *:file:`someheader.h`* to typeset filenames and 
*:code:`someVariable`* to typeset pieces of code in the middle of otherwise 
normal (body) text.
Both come out exactly the same (red monospaced text on a grey background 
with a subtle grey bottom border). However, for the sake of better 
readability, I'd like to customize these roles such that they will produce 
different HTML output (e.g. file names in blue, code objects in a slightly 
darker red).
I checked the HTML source code and saw that a *file name* appears like so:
<p>This is a <code class="*file *docutils literal notranslate"><span class="
pre">folder/folder/file.ext</span></code> example.</p>
And a *code object* appears like so:
<p>This is a <code class="*code *docutils literal notranslate"><span class="
pre">entity_ID</span></code> example.</p>
So the only difference is in the class of the <code> tag, once »file« and 
once »code«
I've scanned various css files in my sphinx installation but somehow was 
not able to find a definition, that, for example, would lead to red text 
and that I could overwrite somewhere. Maybe I did not look thoroughly 
enough … 🤔

In a next step, I would like to introduce more roles, e.g. for console 
input, console output, menu items (as in »select *File > Save as …* to save 
the file under a new name«), and maybe app names. But I guess defining new 
roles would be a rather complex undertaking …

For the time being I'd be more than grateful if someone could point me to a 
solution how to make the roles* :file:* and *:code:* produce different 
outputs. As said earlier, I could not find any hint in the css files … 😐

Any help is much appreciated! Thanks a lot in advance!

All the best,
Jürgen

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sphinx-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sphinx-users/f245b98a-1f72-4b81-bc0c-5cdfa9d8757dn%40googlegroups.com.

Reply via email to