title: How can I keep Jekyll from adding whitespace in highlight?
body: <p>I'm currently experimenting with Jekyll. Most things look fine, but the way Jekyll processes code highlighting seems to be buggy.</p>
  
  <p>I use pygments.</p>
  
  <p>Then Jekyll seems to use pieces like:</p>
  
  <pre><code>{% highlight python %}
  #!/usr/bin/env python
  
  def wer(r, h):
      """
  {% endhighlight %}
  </code></pre>
  
  <p>to generate code like</p>
  
  <pre><code>&lt;div class="highlight"&gt;
     &lt;pre&gt;
        &lt;code class="python"&gt;&lt;span class="c"&gt;#!/usr/bin/env python&lt;/span&gt;
  
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;wer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;h&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
      &lt;span class="sd"&gt;"""&lt;/span&gt;
  &lt;span class="sd"&gt;        Calculation of WER with Levenshtein distance.&lt;/span&gt;
  &lt;span class="sd"&gt;        Works only for iterables up to 254 elements (uint8).&lt;/span&gt;
  &lt;span class="sd"&gt;        O(nm) time ans space complexity.&lt;/span&gt;
  [...]
      &lt;span class="n"&gt;doctest&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;testmod&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
  &lt;/code&gt;
     &lt;/pre&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>which looks like</p>
  
  <p><img src="https://i.stack.imgur.com/Z3ZeE.png" alt="enter image description here"></p>
  
  <p><img src="https://i.stack.imgur.com/5JG6m.png" alt="enter image description here"></p>
  
  <p>The problem is whitespace between <code>code</code> and <code>pre</code>:</p>
  
  <p><img src="https://i.stack.imgur.com/6akbF.png" alt="enter image description here"></p>
  
  <p>How can I tell Jekyll not to put whitespace between those tags?</p>
  
  <ul>
  <li><a href="https://github.com/MartinThoma/MartinThoma.github.io" rel="noreferrer">repository with my blog</a></li>
  <li>a <a href="http://martinthoma.github.io/jekyll-and-git/" rel="noreferrer">rendered example page</a> (with this <a href="https://raw.github.com/MartinThoma/MartinThoma.github.io/source/_posts/2013-12-09-jekyll-and-git.markdown" rel="noreferrer">source page</a>).</li>
  </ul>
  
  <h2>Bug hunting</h2>
  
  <ul>
  <li>My Jekyll version is <code>jekyll 1.3.1</code>.</li>
  <li>With <code>gem environment</code> I found that my gems are at <code>/var/lib/gems/1.9.1</code>.</li>
  <li>With <code>grep -rn "highlight" --exclude-dir=site --exclude-dir=test *</code> I found that the highlight tag gets parsed in <code>/var/lib/gems/1.9.1/gems/jekyll-1.3.1/lib/jekyll/tags/highlight.rb</code></li>
  <li>As this might be a Jekyll bug, I've added <a href="https://github.com/mojombo/jekyll/issues/1801" rel="noreferrer">issue 1801</a></li>
  </ul>
  
  <p>Now comes the strange part: <code>highlight.rb</code> seems not to add any whitespace between <code>&lt;pre&gt;</code> and <code>&lt;code&gt;</code>.</p>