I'm trying to get inline code snippets highlighted while using Sphinx.
I've looked at solution provided at Inline code highlighting in reStructuredText but it does not work for me. I'm using Sphinx 1.4.8.
Is there another simple and elegant way of marking inline code to be highlighted?
In absence of a full solution, i.e. one that supports true language-based highlighting, I would be happy having ability to set a non-black colour for my inline code throughout the document. Is that possible?
Edit1: Here's my code:
.. role:: py(code)
:language: python
here is some inline code :py:`def func():`
The text row here gets rendered all in black instead of keyword 'def' in another colour. Highlighting works perfectly for code-blocks but not inline.
Edit2:
Humbalan's suggestion helped me almost solve this.
I added following to $SPHINX_PROJECT_DIR/_templates/layout.html
:
{# layout.html #}
{# Import the theme's layout. #}
{% extends "!layout.html" %}
{% set css_files = css_files + ['_static/style.css'] %}
Then i created $SPHINX_PROJECT_DIR/_templates/style.css
with following contents to override span.pre
:
span.pre{
color: red;
border: 1px solid black;
padding: 2px;
background: #feeaea
}
I'm closer to the solution but not quite there yet. I get following output now: