Not sure why original Docutils didn't have that.
- Drops the rarely useful :rst:`:encoding:`, :rst:`:literal:` and
:rst:`:name:` options
+- Adds a :rst:`:hl-lines:` option to have the same behavior as
+ the :rst:`.. code::` directive
- Adds a :rst:`:start-on:` and :rst:`:strip-prefix:` options, and improves
:rst:`:end-before:`. See `Advanced file inclusion`_ below.
'end-before': directives.unchanged,
'strip-prefix': directives.unchanged,
'class': directives.class_option,
- 'filters': directives.unchanged
+ 'filters': directives.unchanged,
+ 'hl-lines': directives.unchanged
}
def run(self):
--- /dev/null
+int main() {
+ return 1;
+}
<pre class="m-inverted m-code"><span class="kt">int</span> <span class="nf">main</span><span class="p">()</span> <span class="p">{</span>
<span class="hll"> <span class="k">return</span> <span class="mi">1</span><span class="p">;</span>
</span><span class="p">}</span></pre>
+<p>Same as above, but for a <code class="m-code"><span class="p">..</span> <span class="ow">include</span><span class="p">::</span></code>, which should also support line
+highlighting:</p>
+<pre class="m-inverted m-code"><span class="kt">int</span> <span class="nf">main</span><span class="p">()</span> <span class="p">{</span>
+<span class="hll"> <span class="k">return</span> <span class="mi">1</span><span class="p">;</span>
+</span><span class="p">}</span></pre>
<p>Inline code is here: <code class="cpp m-code"><span class="k">constexpr</span></code>. Code without a language should be
rendered as plain monospace text: <code>code</code>.</p>
<pre class="m-console">!<span class="g g-AnsiBlue">[</span><span class="g g-AnsiBrightWhite">mosra@don-perverzo </span><span class="g g-AnsiWhite">m.css</span><span class="g g-AnsiBlue">]</span><span class="g g-AnsiBrightCyan">$ </span>ls
return 1;
}
+Same as above, but for a :rst:`.. include::`, which should also support line
+highlighting:
+
+.. include:: code.cpp
+ :code: c++
+ :class: m-inverted
+ :hl-lines: 2
+
Inline code is here: :cpp:`constexpr`. Code without a language should be
rendered as plain monospace text: :code:`code`.