question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: nested list not working if indent by 2 spaces

See original GitHub issue

Versions

  • dumi: 1.1.20
  • node: 15.6.0
  • npm: 7.4.0
  • OS: macOS 11.2.3 BigSur
  • Browser: Firefox 89.0.1

Steps to reproduce

Create list with Markdown syntax then dumi dev:

1. xx
  1. xx
2. xx

What is Expected?

Rendered 2-level list.

What is actually happening?

Rendered single level list, but indent by more than 2 spaces will works properly.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
ChristianMurphycommented, Jun 30, 2021

A point of clarification, ordered lists need three or more spaces indent to nest, unordered two or more to nest.

https://babelmark.github.io/?text=1.+A ++1.+A *+A +*+A 1.+A +++1.+A *+A ++*+A

https://astexplorer.net/#/gist/81dd323bf800689e8e5479cfa7b0ee8d/ec430603d07531397796e126061a8f80b3cb198c

The behavior is consistent across implementations and on github itself:


  1. A
  2. A
  • A
  • A
  1. A
    1. A
  • A
    • A

why 2 spaces intent item will be treated as single-level item in the most implementations but remark will treat it as nested list

GitHub also treat 2 spaces intent item as nested list

Remark does the same as the other implementations, see the clarification and examples above.

1reaction
ChristianMurphycommented, Jun 30, 2021

This is by design, it’s how markdown works, when markdown has less than the minimum indent for nesting lists, a single level list is created. This is documented in the commonmark specification at https://spec.commonmark.org/0.30/#example-310 and https://spec.commonmark.org/0.30/#example-311

To improve the developer experience, consider using https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-recommended#readme to highlight places where syntax may be confusing or misused.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nested list requires 4 spaces instead of 2 · Issue #451
Most common Markdown editor uses 2 spaces as the indentation for nested list. But this library requires 4, and there's no way to...
Read more >
Problem making sublists (or nested lists)?
If the list marker takes up two spaces of indentation, and there are three spaces between the list marker and the next character...
Read more >
Nested numbered list indentation differs from bullet lists - GitLab
This bullet list worked, but this numbered one didn't. What is the current bug behavior? The following does not result the same as...
Read more >
[Bug] Nesting a numbered list item by pressing tab doesn't ...
In settings → Editor, set “Tab size” to 2 and “Use tabs” to off. Create a numbered list. Try to make it a...
Read more >
Nested ordered lists indented with 2 spaces are broken
To nest one list within another, indent each item in the sublist by four spaces. …But that doesn't work in the above example...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found