djangosnippets.org: Latest snippets tagged with 'syntax'https://djangosnippets.org/tags/syntax/2010-11-29T14:49:27.115538-06:00Prettify HTML body contents in HTTP response
2010-11-29T14:49:27.115538-06:00n1k0https://djangosnippets.org/snippets/2279/<p>This is an enhancement of snippet <a href="http://djangosnippets.org/snippets/172/">#172</a>. Here I use <a href="http://www.crummy.com/software/BeautifulSoup/">BeautifulSoup</a> — 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. </p>
<p>I also added a check to only tidy contents in …</p>
Freely redistributablePygments Syntax highlighting template tag
2008-11-24T09:42:06.027602-06:00girasquidhttps://djangosnippets.org/snippets/1213/<p>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, …</p>
Freely redistributableCode syntax highlighting templatetag
2007-09-15T14:42:55.181712-05:00badrunnerhttps://djangosnippets.org/snippets/416/<p>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.</p>
<p>This snippet has the advantage of falling back on <pre> if anything goes wrong, and attempting to guess the syntax of code, falling back …</p>
Freely redistributable