gettalong / kramdown

kramdown is a fast, pure Ruby Markdown superset converter, using a strict syntax definition and supporting several common extensions.
http://kramdown.gettalong.org
Other
1.72k stars 275 forks source link

List inside block element (details) inside list not working #747

Closed karmanyaahm closed 2 years ago

karmanyaahm commented 2 years ago

I input this into kramdown 2.3.1 using the command

bundle exec kramdown test.md --parse-block-html
- <details markdown="block">
  <summary markdown="span">Website</summary>
  - detail1
  - detail2
  </details>

and I get out errors and wrong output:

<ul>
  <li>
    <details>
      <summary>Website</summary>
    </details>
    <ul>
      <li>detail1</li>
      <li>detail2</li>
    </ul>
    <p>&lt;/details&gt;</p>
  </li>
</ul>
Warning: Found no end tag for 'details' (line 1) - auto-closing it
Warning: Found invalidly used HTML closing tag for 'details' on line 5

Is my input incorrectly formatted or is this a bug? This error only seems to happen when there's a list inside, not regular text with bold/italics etc. I also tried various different indentation levels for the inside list but this still happened.

PS: thanks for making kramdown :smiley: It has been very useful to my website.

gettalong commented 2 years ago

You need to leave a blank line before </details>, then it will work:

- <details markdown="block">

  <summary markdown="span">Website</summary>
  - detail1
  - detail2

  </details>

Also, if you use the "markdown" attribute, you don't need the parse_block_html option.

karmanyaahm commented 2 years ago

That fixed it. Thanks!