Package: django-rstify
Warningdjango-rstify is not in active development! Please take a look at it’s successor django-markup.https://github.com/bartTC/django-markupdjango-rstify - A restructured text filter for django templatesdjango-rstify is a set of template filters to provide easy conversion fromrestructured textto HTML. Besides this basic functionality this application
allows you to highlight sourcecode snippets inside your text using thepygmentslibrary.HintDjango already provides a simplerestructured text filter. If you
don’t need the extras in this application, I recommend to use thecore version.InstallationThere are several ways to install this application:Checkout the latest version from my git repository:git clone git://github.com/bartTC/django-rstify.gitThen either put the directoryrstifyinto your pythonpath or
switch todjango-rstifyand dopython setup.py install.Install this application using easy_install:easy_install django-rstifyFinally, putrstifyinto yourINSTALLED_APPSsetting in your django project.How to use it in templatesTo convert a restructured text from an object to HTML simply apply therstifyfilter on it:{% load rstify_tags %}

{{ entry.content|rstify }}If you want to convert inline content, use thefiltertemplatetag around:{% load rstify_tags %}

{% filter rstify %}
This is some *restructured text*.
{% endfilter %}How to use it in sourcecodeApplying this filter inside your code is easy:>>> from rstify import rstify
>>>
>>> print rstify('This is *restructured text*.')
<p>This is <em>restructured text</em>.</p>Initial Header LevelBy default the initial heading in your restructured text becomes a<h1>in
HTML:>>> header = '''
... ================
... This is a Header
... ================
... '''
>>> print rstify(header)
<div class="section">
<h1><a id="this-is-a-header" name="this-is-a-header">This is a Header</a></h1>
</div>You can override this by setting theinitial_header_levelto an integer from
1 to 6:>>> print rstify(header, initial_header_level=3)
<div class="section">
<h3><a id="this-is-a-header" name="this-is-a-header">This is a Header</a></h3>
</div>In your template just set this as the first option of therstifyfilter:{{ entry.content|rstify:"3" }}Syntax Highlightingdjango-rstify provides syntax highlighting using thepygmentslibrary. To highlight
parts of your restructured text, simply put it in asourcecodedirective:Here is some text. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Integer porttitor nulla sed dui. Aenean lorem mi, tincidunt et, porttitor
nec, condimentum venenatis, felis. Maecenas ornare blandit leo.

.. sourcecode:: python

    def foo(bar):
        return bar*2

Continue with text. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Integer porttitor nulla sed dui. Aenean lorem mi, tincidunt et, porttitor nec,
condimentum venenatis, felis. Maecenas ornare blandit leo.Pygments provides a bunch of highlighters (also calledlexer), just replacepythonwith a lexer of your choice. Here is a complete set ofavailable lexers.
Readpygments styleshow to colorize the output using css.LicenseThis application is licensed under theNew BSD License. SeeLICENSEfor details.
django-rstify comes bundled with a pygments directive which is released underBSD License.
Seerstify/pygments_directive.pyfor details.