[solved] Kramdown and parse_block_html

I am new to Jekyll and so far really liking it. I wrote a custom liquid plugin to wrap a class around a markdown unordered list. However, when I do that, the list no longer renders and I just see the raw markdown in my generated HTML.

With my plugin and parse_block_html set to true in my config file, it works as expected but then other elements in the site do not render. I realized that probably the best thing is to leave the default for parse_block_html to false. In that case I learned I could do this.

{% styled_list %}
{::options parse_block_html="true" /}
- foo
- bar
- foobar
{% endstyled_list %}

and the list now renders with my class wrapped around it – rendered as:

<div class="styled-list">
  <ul>
    <li>foo</li>
    <li>bar</li>
    <li>foobar</li>
  </ul>
</div>

That’s all well and good but now anything that comes after that that might have some HTML elements, for example an embedded video will not render.

So I am not sure if I am making this harder than it is or if there is a better way to do this.

I just discovered that I can do this:

- foo
- bar
- foobar
{:.styled-list}

… which renders as:

<ul class="styled-list">
  <li>foo</li>
  <li>bar</li>
  <li>foobar</li>
</ul>

That’s fine, I don’t need an extra element wrapped around the list anyway which was what my plugin was doing.

1 Like