Broken when fixing backslash support.
return codeblock.run()
def code(role, rawtext, text, lineno, inliner, options={}, content=[]):
- # In order to properly preserve backslashes
- i = rawtext.find('`')
- text = rawtext.split('`')[1]
+ # In order to properly preserve backslashes (well, and backticks)
+ text = rawtext[rawtext.find('`') + 1:rawtext.rfind('`')]
set_classes(options)
classes = []
latex2svgextra.counter = 0
def math(role, rawtext, text, lineno, inliner, options={}, content=[]):
- # Otherwise the backslashes do quite a mess there
- i = rawtext.find('`')
- text = rawtext.split('`')[1]
+ # In order to properly preserve backslashes (well, and backticks)
+ text = rawtext[rawtext.find('`') + 1:rawtext.rfind('`')]
# Fallback rendering as code requested
if settings['M_MATH_RENDER_AS_CODE']:
<span style="color: #3bd267">‌ </span> <span style="color: #3bd267">‌ </span> <span style="color: #3bd267">‌░░</span> <span style="color: #3bd267">‌▒▒</span> <span style="color: #3bd267">‌▓▓</span> <span style="color: #3bd267; background-color: #3bd267">‌██</span></pre>
<pre class="m-code">// this language is not highlighted</pre>
-<p>Properly preserve backslashes: <code class="m-code"><span class="k">\frac</span><span class="nb">{</span>a<span class="nb">}{</span>b<span class="nb">}</span></code></p>
+<p>Properly preserve backslashes: <code class="m-code"><span class="k">\frac</span><span class="nb">{</span>a<span class="nb">}{</span>b<span class="nb">}</span></code> ... and backticks:
+<code class="m-code"><span class="na">:ref:</span><span class="nv">`a function <os.path.join()>`</span></code></p>
<p>Don't trim leading spaces in blocks:</p>
<pre class="m-code"> <span class="n">nope</span><span class="p">();</span>
<span class="k">return</span> <span class="nb">false</span><span class="p">;</span>
:language: c++
.. role:: tex(code)
:language: tex
+.. role:: rst(code)
+ :language: rst
.. code:: c++
// this language is not highlighted
-Properly preserve backslashes: :tex:`\frac{a}{b}`
+Properly preserve backslashes: :tex:`\frac{a}{b}` ... and backticks:
+:rst:`:ref:`a function <os.path.join()>``
Don't trim leading spaces in blocks: