Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jekyll Kramdown code in ordered list - number reset

I have the following code which resets the numbered list after adding a liquid code block:

...
6. Install the Ruby Google API client with `gem install google-api-client`, or if you prefer in a Gemfile:
    {% highlight ruby lineanchors %}
    source 'https://rubygems.org'
    gem 'google-api-client', '~> 0.9.1'
    {% endhighlight %}
(If you've never used [Bundler](http://bundler.io) before, you should start!)

7. Let's get a quick script set up to post a Google Calendar event to...

The problem is that the following renders as:


fail


The ordered list is reset, which is obviously a problem. I've looked at many posts that detail the markdown ordered list reset problem but none of them discuss liquid tags. I found another post here discussing the issue to no avail.

Here is the HTML output just in case it is necessary. The <ol> tag is clearly being broken by a <div> element produced by the liquid tag engine... and I don't know how to embed the pre block in the <ol> block...

<ol>
  ...
  <li>Install the Ruby Google API client with <code>gem install google-api-client</code>, or if you prefer in a Gemfile:</li>
</ol>
<div class="highlight"><pre><code class="language-ruby" data-lang="ruby"><a name="True-1"></a><span class="n">source</span> <span class="s1">'https://rubygems.org'</span>
<a name="True-2"></a><span class="n">gem</span> <span class="s1">'google-api-client'</span><span class="p">,</span> <span class="s1">'~&gt; 0.9.1'</span></code></pre></div>
<p>(If you’ve never used <a href="http://bundler.io">Bundler</a> before, you should start!)</p>
<ol>
  <li>Let’s get a quick script set up to post a Google Calendar event to</li>
  <li>Let’s get a quick script set up to post a Google Calendar event to</li>
</ol>

I want to be able to put a liquid tag in an ordered list without it breaking the <ol> HTML element and resetting the numbering. Is there a way to do this?

like image 692
Chris Cirefice Avatar asked Mar 08 '16 04:03

Chris Cirefice


1 Answers

For those with this issue, adding extra info in front of the next number helped me.

6. Install the Ruby Google API client with `gem install google-api-client`, or if you prefer in a Gemfile:
    {% highlight ruby lineanchors %}
    source 'https://rubygems.org'
    gem 'google-api-client', '~> 0.9.1'
    {% endhighlight %}
(If you've never used [Bundler](http://bundler.io) before, you should start!)

{:start="7"}
7. Let's get a quick 
like image 114
Yohan Chung Avatar answered Oct 28 '22 08:10

Yohan Chung