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: incorrectly warns when mixing ul/ol #975

Closed
EvaSDK opened this issue Jan 29, 2024 · 7 comments
Closed

MD007: incorrectly warns when mixing ul/ol #975

EvaSDK opened this issue Jan 29, 2024 · 7 comments

Comments

@EvaSDK
Copy link

EvaSDK commented Jan 29, 2024

I have a few documents that should be valid but are reporting issues in pymarkdown due to what appears to be a problem related to mixing types of lists.

Here is the sample file:

# Lorem Ipsum

- Lorem ipsum dolor sit amet, consectetur adipiscing elit.
    - Sed sit amet tellus interdum, fringilla sem id, porta dolor.
    - Pellentesque posuere felis vel est scelerisque, eget ultrices enim pellentesque.

1. Phasellus porta leo quis libero feugiat, vel interdum massa lobortis.
    - Nam eget metus nec ante lacinia accumsan id eu libero.
    - Nulla tristique tortor et suscipit condimentum.

Here is configuration file:

{
  "plugins": {
    "ul-indent": {
      "indent": 4
    }
  }
}

Running pymarkdown returns:

$ pymarkdown version
0.9.16
$ pymarkdown scan test.md
test.md:8:5: MD007: Unordered list indentation [Expected: 4, Actual=5] (ul-indent)
test.md:9:5: MD007: Unordered list indentation [Expected: 4, Actual=5] (ul-indent)

This issue is not new (had the same with 0.9.13.4). markdownlint has no issue with this document but I try to avoid it as I'm using this tool in pre-commit and I don't want to bother getting NPM in my CI for this.

@EvaSDK
Copy link
Author

EvaSDK commented Jan 29, 2024

Forgot to mention the reason I'm using 4-spaces indent is because the documents are meant to be consumed by mkdocs so it goes through mdformat-mkdocs which enforces this.

@horejsek
Copy link

I experience the same issue.

@jackdewinter
Copy link
Owner

jackdewinter commented Jan 31, 2024

Just noticed that we had that issue a while back #301... looking into it.

And not an excuse, but an explanation of sorts. When doing research for that rule, I believe that any amount of indentation of an unordered list in an ordered list will not fire.

1. ffff
     + dddd

for example will not fire. But change the 1. to a + and it fires right away.

Still, working on it.

@jackdewinter
Copy link
Owner

Actually, downloaded the tool and tried something out. Can I get you to verify what happens when you copy this snippet to a file and scan it through the tool?

- abc
  - def

1. abc
   - def

> - abc
>   - def
>
> 1. abc
>    - def

@EvaSDK
Copy link
Author

EvaSDK commented Feb 1, 2024

Here is what I get:

$ npm install markdownlint-cli
$ npx markdownlint issue975-issuecomment-1920378562.md
issue975-issuecomment-1920378562.md:1 MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "- abc"]
$ pymarkdown scan issue975-issuecomment-1920378562.md
issue975-issuecomment-1920378562.md:1:1: MD041: First line in file should be a top level heading (first-line-heading,first-line-h1)

@jackdewinter
Copy link
Owner

@EvaSDK Sorry, I meant mkdocs. When I did it here, it made sure that both ordered and unordered lists stuck to that 4 indent basis.

Md007 only deals with unordered lists, and changing that did not sit well with me. So, I created a new PML101 that uses "anchored list indents" that seems to work in all the cases I have thrown at it, validated by mdformat and mkdocs. It should be released within a couple of days.

@jackdewinter
Copy link
Owner

closed as open for too long.

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

3 participants