Skip to content

Commit

Permalink
Added docs how to set Pygments class names to short format. Closes #23.
Browse files Browse the repository at this point in the history
  • Loading branch information
bartTC committed Sep 14, 2017
1 parent 78e1262 commit 268b558
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions docs/bundled_filter/rst.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,55 @@ class or using the global settings::
}


Syntax Highlighting:
====================

Pygments_ will automatically add a ``code-block`` directive with syntax
highlighting.

rST Input::

Some **rST** text.
.. code-block:: python
def test():
return 'Hello World'

Output::

<div class="document">
<p>Some <strong>rST</strong> text.</p>
<pre class="code python literal-block">
<span class="keyword">def</span> <span class="name function">test</span><span class="punctuation">():</span>
<span class="keyword">return</span> <span class="literal string single">\'Hello World\'</span>
</pre>
</div>


By default, reStructuredText uses long class names. You can change the format
of the class names using the syntax_highlight_ option::

MARKUP_SETTINGS = {
'restructuredtext': {
'settings_overrides': {
'syntax_highlight': short,
}
}
}

Above output but with `short` option::

<div class="document">
<p>Some <strong>rST</strong> text.</p>
<pre class="code python literal-block">
<span class="keyword">def</span> <span class="name function">test</span><span class="punctuation">():</span>
<span class="keyword">return</span> <span class="literal string single">\'Hello World\'</span>
</pre>
</div>


.. _reStructuredText: http://docutils.sourceforge.net/rst.html
.. _quick reference: http://docutils.sourceforge.net/docs/user/rst/quickref.html
.. _Pygments: http://pygments.org
.. _syntax_highlight: http://docutils.sourceforge.net/docs/user/config.html#syntax-highlight

0 comments on commit 268b558

Please sign in to comment.