rdiscount icon indicating copy to clipboard operation
rdiscount copied to clipboard

Allow stricter handling of consecutive bullet lists with MKD_EXPLICITLIST flag

Open DannyBen opened this issue 8 years ago • 6 comments

Code:

require 'rdiscount'

markdown = <<EOF
- Bullet
- Bullet

1. Numbered
2. Numbered
EOF

puts RDiscount.new(markdown).to_html

Output:

<ul>
  <li>Bullet</li>
  <li><p>Bullet</p></li>
  <li><p>Numbered</p></li>
  <li>Numbered</li>
</ul>

Expected Output:

<ul>
  <li>Bullet</li>
  <li>Bullet</li>
</ul>
<ol>
  <li>Numbered</li>
  <li>Numbered</li>
</ol>

If anything is inserted between the lists (like ----), the result is fine.

DannyBen avatar Jun 11 '16 16:06 DannyBen

Confirmed with underlying Discount 2.2.0.

Reported upstream at: https://github.com/Orc/discount/issues/150

davidfstr avatar Jun 12 '16 19:06 davidfstr

The upstream is closed with comment https://github.com/Orc/discount/issues/150#issuecomment-225477646

Sadly, this is not a defect; it's the way markdown processes lists :-(

I'm working on yet another effing option flag to process lists in the expected nonsurprising manner, but it has to be an option because the reference implementation merges adjacent lists no matter what type they are.

Should this also be closed?

jesperronn avatar Mar 08 '17 09:03 jesperronn

It seems now that it is possible to get the expected output mentioned above via the new MKD_EXPLICITLIST flag that Discount just added for v2.2.3b6 . However RDiscount doesn't support this flag yet. I'll plan to wait until Discount 2.2.3(final) is released before supporting that option.

davidfstr avatar Mar 11 '17 02:03 davidfstr

Discount 2.2.3 final has been released, so this issue is now unblocked.

davidfstr avatar Apr 22 '21 14:04 davidfstr

This is an old issue, and I have since moved on - but I am not sure why is this considered "not a defect" as mentioned in the linked comment. This is purely a bug. It does not need flags to be "stricter", it needs to be fixed... nobody needs the broken behavior. A new line in markdown marks the end of a block, as is the case in all other markdown implementations I have seen.

DannyBen avatar Apr 22 '21 15:04 DannyBen

FWIW, I'm classifying it as a feature because it is something that will need to be requested explicitly via flag.

it needs to be fixed... nobody needs the broken behavior.

I am certain there are folks depending on the old behavior. I'm not planning on breaking the world without a good reason.

davidfstr avatar Apr 22 '21 18:04 davidfstr