-
Notifications
You must be signed in to change notification settings - Fork 17
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
bug: MD012 for whitespace around pyml comments #1208
Comments
Cool insights... will look into this in the coming week. |
This has been fixed, will make it into the next release. |
Yay! Thanks so much! |
my mistake, this made it into the last release. |
Ah good to know, thanks for making this change! |
Hi @jackdewinter thanks for making progress on this, and thanks also for creating and maintaining pymarkdown. I'm one of @XavierChanth's colleagues, and we've been working together on dealing with this (as I'm the one who introduced pymarkdown to some of our repos). I just did a quick test, and whilst the original problem with md012 seems to be resolved in 0.9.25 there now seems to be a similar issue with md022. So when I scan a markdown file that contains something like: ## My header
<!-- pyml disable-num-lines 3 md011,md013-->
Some long lines I get: |
yup... I thought about that too, but was hoping that you would not find it until I had a chance to work on it. If you do not mind, could you file a separate issue, linking this issue to it? And for that one, just state this as an example and to double check any "multiple line" rules. If not, I will probably get to it in early december, and will create one then. |
Thanks... appreciate it. |
Prerequisites
Bug Report
Please replace any of
[these areas]
in the paragraphs below with the requested information.Bug Type
Parsing rules
Description
pyml disable-num-lines
comments are ignored in the parsing of documents, thus appearing as a double line in scenarios like:Both line 2 and 4 of my example are being flagged as a double line (MD012), but they don't appear as a double line if the comment is not marked with
pyml
.But this doesn't trigger md012 (no pyml annotation):
Obviously, this doesn't disable md013 though.
The reason that this is a problem is that most markdown formatters will pad comment blocks like this. I haven't found any markdown formatters that allow you to disable comment formatting, so please point me to one if you are aware of it.
There are two workarounds, that I've found:
Modify the md012 maximum with
-s plugins.md012.maximum=$#2
But this still causes problems around headers due to md022.
Disable md012 outright
I would prefer not to, and it still has issues with md022.
Potential solutions:
I think it would be a great feature to have a flag that tells the parser to completely ignore any blank lines which follow comments with a
pyml
in them, this way the following scenario would still work:Specifics
What operating system and version are you running into this behavior on?
Occurring in both macOS (local) and GitHub actions ubuntu-latest runner
What version are you seeing this behavior in? (Run
pip list
orpipenv run pip list
and look for the entry besidepymarkdownlnt
.)0.9.23
Are there any extra steps that need to be taken before executing the application?
N/A
What is the command line you invoke to get this behavior?
cat <file> | pymarkdownlnt scan-stdin
Are you using a configuration file? Either on the command line or one of the implicit configuration files? If so, attach that file to this issue.
N/A
What Markdown document causes this behavior to manifest? Attach that file to this issue.
README.md
Actual Behavior
MD012 warning for whitespace around comments annotated with
pyml
Expected Behavior
No MD012 warning
The text was updated successfully, but these errors were encountered: