You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The original markdown spec was not precise about the indentation sublists. See CommonMark Spec section "1.2 Why is a spec needed?" for a bit of context.
Example 2 spaces indentation:
- B1
- B1.1
- B1.1.1
Markview render:
Example 4 spaces indentation:
- B1
- B1.1
- B1.1.1
Markview render:
There are many style guides, parser tools, linters and formatters in the markdown ecosystem. There are also many different personal style preferences.
For example, the default markdownlint rules expect 2 spaces of indentation and that the first "-" is not indented. See MD007. In a .markdownlint.yaml file, the default would be like this:
MD007:
indent: 2start_indented: false# when start_indented is set, start_indent applies:start_indent: 2
I find their rational for this choice to be quite convincing:
Rationale: Indenting by 2 spaces allows the content of a nested list to be in line with the start of the content of the parent list when a single space is used after the list marker. Indenting by 4 spaces is consistent with code blocks and simpler for editors to implement. Additionally, this can be a compatibility issue for other Markdown parsers, which require 4-space indents. More information: Markdown Style Guide.
I would also argue that Markview's indentation of the top level list is not visually pleasing and does not represent the expected alignment.
Thanks for all your great work and positive attitude. Keep it up!
📂 Possible solutions:
Auto-detect preferred style based on first sublist indent? or based on shiftwidth which can itself be autodected by vim-sleuth
Make the default preference configurable?
Allow automatic override based on local/nearest .markdownlint.yaml and/or other linter configs -- this would be great to allow seemless editing of markdown files from multiple projects with different styles.
It might be nice to have different options for the parsing side:
how many spaces required to "detect" a sublist, e.g., 2, 4, auto-detect, match-shiftwidth
.. and the rendering side:
how many spaces to visually indent, e.g., 2, 4, match-document
should start/top-level lists be indented, e.g., true, false, 2, 4, match-document, match-sublist-indent