title: How can I strip whitespace and newlines with Mako templates? My 12362 line HTML file is killing IE
body: <p>I'm using the Mako template system in my Pylons website and am having some issues with stripping whitespace.</p>
  
  <p>My reasoning for stripping whitespace is the generated HTML file comes out as 12363 lines of code. This, I assume, is why Internet Explorer is hanging when it tries to load it.</p>
  
  <p>I want to be able to have my HTML file look nice and neat so I can make changes to it with ease and have the generated output look as ugly and messy as required to cut down on filesize and memory usage.</p>
  
  <p>The Mako documentation <a href="http://www.makotemplates.org/docs/filtering.html" rel="nofollow noreferrer">http://www.makotemplates.org/docs/filtering.html</a> says you can use the <code>trim</code> flag but that doesn't seem to work. Example code:</p>
  
  <pre><code>&lt;div id="content"&gt;
      ${next.body() | trim}
  &lt;/div&gt;
  </code></pre>
  
  <p>The only way I've been able to strip the newlines is to add a <code>\</code> (backslash) to the end of each line. This is rather annoying when coding the views and I'd prefer to have a centralized solution.</p>
  
  <p>How do I remove the whitespace/newlines ?</p>