title: Variable substitution not working properly in Sphinx
body: <p>I have a documentation project made with <a href="http://www.sphinx-doc.org/en/stable/" rel="nofollow noreferrer">Sphinx</a>. I am using global variables by means of the configuration key <code>rst_epilog</code>. My <code>conf.py</code> file contains the following:</p>
  
  <pre><code>rst_epilog = """
  .. |MY_VERSION| replace:: 2.1.0
  """
  </code></pre>
  
  <p>Then, in a rst page, I'm using the formerly defined variable (<code>VERSION</code>) as follows:</p>
  
  <pre><code>The version of my repo is: |MY_VERSION|
  
  .. sourcecode:: bash
  
      git clone https://github.com/my-organization/my-repo.git
      cd my-repo
      git checkout |MY_VERSION|
  </code></pre>
  
  <p>After building the documentation, in the resulting HTML, the first variable is correctly substituted, but not the second:
  <a href="https://i.stack.imgur.com/zwjSg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zwjSg.png" alt="enter image description here"></a></p>
  
  <p>Clearly the substitution does not work inside formatted source code blocks, which is very inconvenient.</p>
  
  <p>Is it possible to workaround this issue?</p>
  
  <p>PS: I also tried with <code>rst_prolog</code> with the same result.</p>