octopress / codefence

Write beautiful fenced code snippets with in any template.
MIT License
16 stars 16 forks source link

Fenced code blocks not being parsed on Jekyll collections #6

Closed ramsey closed 9 years ago

ramsey commented 9 years ago

From a Jekyll post or page, fenced code blocks are parsed as expected, but from a Jekyll collection document, it appears that octopress-codefence is not being invoked at all. Is this a limitation of octopress-codefence or Jekyll?

Given the following fenced codeblock:

``` ruby linenos:false
def print_hi(name)
  puts "Hi, #{name}"
end
print_hi('Tom')
#=> prints 'Hi, Tom' to STDOUT.

I receive the following HTML output on posts and pages, and I expect to see this output on collections:

``` html
<figure class="code-highlight-figure"><div class="code-highlight"><pre class="code-highlight-pre"><div data-line="1" class="code-highlight-row unnumbered"><div class="code-highlight-line"><span class="k">def</span> <span class="nf">print_hi</span><span class="p">(</span><span class="nb">name</span><span class="p">)</span>
</div></div><div data-line="2" class="code-highlight-row unnumbered"><div class="code-highlight-line">  <span class="nb">puts</span> <span class="s2">&quot;Hi, </span><span class="si">#&#x7b;</span><span class="nb">name</span><span class="si">&#x7d;</span><span class="s2">&quot;</span>
</div></div><div data-line="3" class="code-highlight-row unnumbered"><div class="code-highlight-line"><span class="k">end</span>
</div></div><div data-line="4" class="code-highlight-row unnumbered"><div class="code-highlight-line"><span class="n">print_hi</span><span class="p">(</span><span class="s1">&#39;Tom&#39;</span><span class="p">)</span>
</div></div><div data-line="5" class="code-highlight-row unnumbered"><div class="code-highlight-line"><span class="c1">#=&gt; prints &#39;Hi, Tom&#39; to STDOUT.</span></div></div></pre></div></figure>

On Jekyll collections, however, this is the HTML output I get:

<p><code>ruby linenos:false
def print_hi(name)
  puts "Hi, #{name}"
end
print_hi('Tom')
#=&gt; prints 'Hi, Tom' to STDOUT.
</code></p>

This is the output I see in the actual Jekyll collection document that is generated when I use the following configuration in _config.yml:

collections:
  notes:
    output: true
    permalink: /notes/:path/

Thanks in advanced for your help.