title: Inline code highlighting in Sphinx (reST)
body: <p>I'm trying to get inline code snippets highlighted while using Sphinx.</p>
  
  <p>I've looked at solution provided at <a href="https://stackoverflow.com/questions/10870719/inline-code-highlighting-in-restructuredtext?rq=1">Inline code highlighting in reStructuredText</a> but it does not work for me. I'm using Sphinx 1.4.8.</p>
  
  <p>Is there another simple and elegant way of marking inline code to be highlighted?</p>
  
  <p>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?</p>
  
  <p>Edit1:
  Here's my code:</p>
  
  <pre><code>.. role:: py(code)
     :language: python
  
  here is some inline code :py:`def func():`
  </code></pre>
  
  <p>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.</p>
  
  <p>Edit2:</p>
  
  <p>Humbalan's suggestion helped me almost solve this.
  I added following to <code>$SPHINX_PROJECT_DIR/_templates/layout.html</code>:</p>
  
  <pre><code>{# layout.html #}
  {# Import the theme's layout. #}
  {% extends "!layout.html" %}
  {% set css_files = css_files + ['_static/style.css'] %}
  </code></pre>
  
  <p>Then i created <code>$SPHINX_PROJECT_DIR/_templates/style.css</code> with following contents to override <code>span.pre</code>:</p>
  
  <pre><code>span.pre{
      color: red;
      border: 1px solid black;
      padding: 2px;
      background: #feeaea
  }
  </code></pre>
  
  <p>I'm closer to the solution but not quite there yet. I get following output now:</p>
  
  <p><a href="https://i.stack.imgur.com/iFXJ4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iFXJ4.png" alt="enter image description here"></a></p>