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

Fix MD025 rule #1109

Closed

Conversation

oliviertassinari
Copy link

@oliviertassinari oliviertassinari commented Jan 25, 2024

This rule was doing nothing on our codebase. Spotted this in mui/material-ui#40784.

@samuelsycamore is you see recurring issues done on the docs or blog, feel free to invest time in markdown lint rules, this will help us scale quality content, we have a couple of custom ones on the codebase already (e.g. git diff format, straight quotes, table alignment, terminal language).

Comment on lines 2 to 8

# Heading 1

# Heading 2
# Heading 2 {MD025}

<!-- markdownlint-configure-file {
"first-line-heading": false
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new regression test

} else if (token.lineNumber === 1) {
} else {
Copy link
Author

@oliviertassinari oliviertassinari Jan 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix, this condition made no sense to me.

@DavidAnson
Copy link
Owner

Per the documentation, MD025 only applies when there is a top-level heading in the document, which it defines as an H1 on the first line:
https://github.com/DavidAnson/markdownlint/blob/main/doc/md025.md

The proposed edit in this PR seems to change that behavior to prevent multiple H1 regardless of where the first is located. I can see why one might want to enforce that, but it represents a change to how this rule has always behaved and will introduce new violations like the ones in this PR.

I do not think it is appropriate to redefine a rule after it has been in use for a long time, so I am inclined not to accept this change.

@oliviertassinari
Copy link
Author

oliviertassinari commented Jan 28, 2024

but it represents a change to how this rule has always behaved and will introduce new violations like the ones in this PR

I don't understand how the position of the h1 in the document is relevant to this rule. I would understand this as a bug fix.

Screenshot 2024-01-28 at 23 54 10

But fair enough, I need to create a custom rule anyway mui/material-ui#40835. I'm closing.

👍 to add a params for such a case.

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

Successfully merging this pull request may close these issues.

2 participants