snarkdown icon indicating copy to clipboard operation
snarkdown copied to clipboard

Nested lists not working

Open MaxTru opened this issue 4 years ago • 3 comments

I would like to have nested lists. I cannot get them to work. I tried various "styles" (e.g., 2 spaces, 4 spaces). See example below.

Example

Markdown input

* Fruit
  * Apple
  * Orange
* Milk
  * Cheese

Expected output

<ul>
  <li>Fruit
    <ul>
      <li>Apple</li>
      <li>Orange</li>
    </ul>
  </li>
  <li>Milk
    <ul>
      <li>Cheese</li>
    </ul>
  </li>
</ul>

Actual output

<ul>
  <li>Fruit</li>
</ul>
<em> Apple</em> 
Orange
<ul>
  <li>Milk</li>
</ul>
<em> Cheese</em>

Context

snarkdown 2.0.0

MaxTru avatar Jan 21 '22 13:01 MaxTru

Also having this issue, but it looks intentional:

https://github.com/developit/snarkdown/blob/7619436b10a3e31e6779bf1209da4762409b86be/src/index.js#L67-L77

I think most people would be willing to have a few extra lines of code for such a feature. I know that elements inside elements aren't part of this code base, but it doesn't necessarily take many lines to add.

SephReed avatar Mar 22 '22 21:03 SephReed

For now, this works:

- hey
- there
- delilah<ul>
- what's
- it 
- like
</ul>
- in <ul>
- new
- york
- city
</ul>

Hard to read, but that will generate nested lists.

SephReed avatar Mar 22 '22 21:03 SephReed

Any timeline to merge this? or get this fixed?

samuellawrentz avatar May 07 '24 05:05 samuellawrentz