Markdown in nested divs not being processed

715 views Asked by At

I'm creating a theme using Bootstrap with jekyll and I'm running into a problem when creating content in markdown. Ideally I'd like to structure my posts with Bootstrap grids like so:

<div class="row">
  <div class="col col-md-6" markdown="1">
  # Hello World
  </div>
</div>

However, the markdown isn't being processed here. It doesn't seem to work in nested HTML blocks.

Single level blocks will work:

<div markdown="1">
# Hello World
</div>

I'm using Kramdown and I can't see any examples similar to this in the docs. I'm guessing maybe I need to create a plugin to do this?

2

There are 2 answers

0
Waylan On BEST ANSWER

Kramdown's documentation simply states regarding stx style headers

No spaces are allowed before the hash characters.

Therefore, you need to delete the indentation of your Markdown content within the div tag:

<div class="row">
  <div class="col col-md-6" markdown="1">
# Hello World
  </div>
</div>
0
Jahnertz On

I wrote a small plugin to add liquid tags for the grid system here (Heavily based on this tutorial)

This doesn't really answer the question, but it does get the job done.