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

MD025 does not trigger when first lines are empty and/or comments #1420

Open
xefiry opened this issue Nov 15, 2024 · 1 comment
Open

MD025 does not trigger when first lines are empty and/or comments #1420

xefiry opened this issue Nov 15, 2024 · 1 comment

Comments

@xefiry
Copy link

xefiry commented Nov 15, 2024

The error MD025 "Multiple top-level headings in the same document" should trigger when there is more than one heading level 1 in the document.

However, if there are empty and/or comment lines before the first heading, the error does not trigger.

Example with an empty line and a comment

<!-- omit in toc -->
# Title

- [Foo](#foo)

# Foo

In this example, the comment is to ignore Title in the generation of the table of content by the extension Markdown All in One, but any comment will do.

The error can be reproduced with any amount of comment lines or empty lines before the first heading.

@DavidAnson
Copy link
Owner

This rule is behaving as documented (a top level heading must be on the first line), but I agree that being preceeded by a blank line doesn't seem like it should disable the rule.

https://github.com/DavidAnson/markdownlint/blob/main/doc/md025.md

@DavidAnson DavidAnson transferred this issue from DavidAnson/vscode-markdownlint Nov 16, 2024
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