Snippet List
This is an enhancement of snippet [#172](http://djangosnippets.org/snippets/172/). Here I use [BeautifulSoup](http://www.crummy.com/software/BeautifulSoup/) — far more easier to install through pip in a virtualenv, and possibly a bit more maintained — to format and properly indent the rendered HTML from templates.
I also added a check to only tidy contents in a `DEBUG=True` environment, regarding high impact on performance while doing so in production.
Last, it's compatible with Django 1.2.x.
- templates
- format
- html
- tidy
- syntax
- output
- prettify
- formatting
- indentation
- readability
This template tag will attempt to apply pygments syntax highlighting to anything inside {% code %} and {% endcode %} tags. You can optionally pass in the language to highlight in the form of {% code 'lang' %} - if you don't, it will first try to guess the syntax, and then fall back to Python syntax highlighting.
- templatetag
- pygments
- highlighting
- syntax
Replaces <code> blocks with syntax highlighted code. Use CSS to actually get the colours you want, look at pygments documentation for extracting css for various styles.
This snippet has the advantage of falling back on <pre> if anything goes wrong, and attempting to guess the syntax of code, falling back on python.
- templatetag
- pygments
- highlighting
- beautifulsoup
- templatetags
- syntax
- syntax-highlightin
3 snippets posted so far.