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

MD007: Allow several values for start_indent #973

Open
skwde opened this issue Sep 14, 2023 · 2 comments
Open

MD007: Allow several values for start_indent #973

skwde opened this issue Sep 14, 2023 · 2 comments

Comments

@skwde
Copy link

skwde commented Sep 14, 2023

Here are the relevant .markdownlint.yaml settings

# MD004/ul-style - Unordered list style
MD004:
  # List style
  style: sublist

# MD007/ul-indent - Unordered list indentation
MD007:
  # Spaces for indent
  indent: 4
  # Whether to indent the first level of the list
  # start_indented: true
  # Spaces for first level indent (when start_indented is set)
  # start_indent: 0

# MD010/no-hard-tabs - Hard tabs
MD010:
  # Include code blocks
  code_blocks: true
  # Number of spaces for each hard tab
  spaces_per_tab: 4

# Disable line length check for tables and code blocks
# MD013/line-length - Line length
MD013:
  # Include code blocks
  code_blocks: false
  # Include tables
  tables: false

# MD029/ol-prefix - Ordered list item prefix
MD029:
  # List style
  style: ordered

This might be related to #284.
The following markdown

1. example1

    - sub 11
    - sub 12

2. example

    - sub 21
    - sub 22

is formatted to

1.  example1

    +   sub 11
    +   sub 12

2.  example

    +   sub 21
    +   sub 22

because the ul is thought to be at level two, but the actual ul level is 1, just appears under an ol.
If we can specify

Another use case are configuration possibilities when using the plugins for admonitions or content tabs (Both are fairly popular for the commonly used mkdocs material theme for documentation.
markdown-it-admon support for admonitions is added (somehow related DavidAnson/vscode-markdownlint#302 at least for me :)).

However than problems arise with

this is normal list

-   cde
    +   cde

now an admonition follows

!!! note "abc"

    abc

    -   cde
 

Similarly if the proposed rule of #138 is implemented it is also important there.

@DavidAnson
Copy link
Owner

The existing issues you've linked to seem to cover most of what you describe here. What is new or unique for this issue?

@skwde
Copy link
Author

skwde commented Sep 15, 2023

To my understanding #284 only asks for a check on the correct number of spaces?! I linked it because I though required changes are similiar?!

Whereas I asked for the possibility to allow ul to start at multiples of start_indent.

Here are some examples demonstrating what I ask for.
With

MD007:
  # Spaces for indent
  indent: 4

we only allow lists to start at the beginning of the line, e.g.

-   cde
    +   cde

While with

MD007:
  # Spaces for indent
  indent: 4
  # Whether to indent the first level of the list
  start_indented: true
  # Spaces for first level indent (when start_indented is set)
  start_indent: 2

we allow

  -   cde
      +   cde

but not the example starting at the beginning of the line.

With a setting allow_multiple_start (or similar):

MD007:
  # Spaces for indent
  indent: 4
  # new option
  allow_multiple_starts: [0,4,8]

we would be more flexible.

Moreover, as I mentioned in the issue description, with the config I posted, the ul list inside the ol is recognized to start at level 2 ul list and formatted accordingly (starting it with a + instead a -). In my mind that's unexpected behavior?!

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

No branches or pull requests

2 participants