djangosnippets.org: Latest snippets tagged with 'indentation'https://djangosnippets.org/tags/indentation/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 redistributableTemplate Filter: Add indentation
2009-08-26T20:25:58.654889-05:00chuck-harmstonhttps://djangosnippets.org/snippets/1702/<p>Template filter to add the given number of tabs to the beginning of each line. Useful for keeping markup pretty, plays well with Markdown.</p>
<p>Usage: </p>
<pre><code>{{ content|indent:"2" }}
{{ content|markdown|indent:"2" }}
</code></pre>
Freely redistributable