jekyll: syntax highlight within list entry breaks the list

sample:

- item 1
- item 2
  {% highlight ruby %}
  def foo
     p 1
  end
  {% highlight %}
- item 3

the code block within second entry breaks the list in two. generates html like this:

<ul>...</ul>
<div class="highlight"></div>
<ul>...</ul>

About this issue

  • Original URL
  • State: closed
  • Created 12 years ago
  • Comments: 31 (11 by maintainers)

Commits related to this issue

Most upvoted comments

@zhanghaowx Interesting! I see that you get the same thing with GitHub-Flavored Markdown, so maybe it’s the newlines in between the code block and the numbers:

1. List item 1
2. List item 2

    ```ruby
    def i_am_highlighted
      puts "Hello, I am highlighted!"
    end
    ```

3. List item 3

@olleharstedt If you’re using kramdown and rouge, use exactly 4 spaces in your lists:

1. List item 1
2. List item 2
    ```ruby
    def i_am_highlighted
      puts "Hello, I am highlighted!"
    end
    ```
3. List item 3