Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested lists not working #104

Open
MaxTru opened this issue Jan 21, 2022 · 3 comments · May be fixed by #111
Open

Nested lists not working #104

MaxTru opened this issue Jan 21, 2022 · 3 comments · May be fixed by #111

Comments

@MaxTru
Copy link

MaxTru commented Jan 21, 2022

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

@SephReed
Copy link

SephReed commented Mar 22, 2022

Also having this issue, but it looks intentional:

snarkdown/src/index.js

Lines 67 to 77 in 7619436

else if (t = token[6]) {
if (t.match(/\./)) {
token[5] = token[5].replace(/^\d+/gm, '');
}
inner = parse(outdent(token[5].replace(/^\s*[>*+.-]/gm, '')));
if (t=='>') t = 'blockquote';
else {
t = t.match(/\./) ? 'ol' : 'ul';
inner = inner.replace(/^(.*)(\n|$)/gm, '<li>$1</li>');
}
chunk = '<'+t+'>' + inner + '</'+t+'>';

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
Copy link

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.

@samuellawrentz
Copy link

Any timeline to merge this? or get this fixed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants