/docs/ref/contrib/markup.txt
Plain Text | 49 lines | 38 code | 11 blank | 0 comment | 0 complexity | 1ea8d1e3b03c76ccd3a599a562a0c322 MD5 | raw file
1===================== 2django.contrib.markup 3===================== 4 5.. module:: django.contrib.markup 6 :synopsis: A collection of template filters that implement common markup languages. 7 8Django provides template filters that implement the following markup 9languages: 10 11 * ``textile`` -- implements `Textile`_ -- requires `PyTextile`_ 12 * ``markdown`` -- implements `Markdown`_ -- requires `Python-markdown`_ 13 * ``restructuredtext`` -- implements `reST (reStructured Text)`_ 14 -- requires `doc-utils`_ 15 16In each case, the filter expects formatted markup as a string and 17returns a string representing the marked-up text. For example, the 18``textile`` filter converts text that is marked-up in Textile format 19to HTML. 20 21To activate these filters, add ``'django.contrib.markup'`` to your 22:setting:`INSTALLED_APPS` setting. Once you've done that, use 23``{% load markup %}`` in a template, and you'll have access to these filters. 24For more documentation, read the source code in 25:file:`django/contrib/markup/templatetags/markup.py`. 26 27.. warning:: 28 29 The output of markup filters is marked "safe" and will not be escaped when 30 rendered in a template. Always be careful to sanitize your inputs and make 31 sure you are not leaving yourself vulnerable to cross-site scripting or 32 other types of attacks. 33 34.. _Textile: http://en.wikipedia.org/wiki/Textile_%28markup_language%29 35.. _Markdown: http://en.wikipedia.org/wiki/Markdown 36.. _reST (reStructured Text): http://en.wikipedia.org/wiki/ReStructuredText 37.. _PyTextile: http://loopcore.com/python-textile/ 38.. _Python-markdown: http://www.freewisdom.org/projects/python-markdown 39.. _doc-utils: http://docutils.sf.net/ 40 41reStructured Text 42----------------- 43 44When using the ``restructuredtext`` markup filter you can define a 45:setting:`RESTRUCTUREDTEXT_FILTER_SETTINGS` in your django settings to 46override the default writer settings. See the `restructuredtext writer 47settings`_ for details on what these settings are. 48 49.. _restructuredtext writer settings: http://docutils.sourceforge.net/docs/user/config.html#html4css1-writer