Skip to content

bug: MD022 for whitespace around pyml comments #1268

@cpswan

Description

@cpswan

Prerequisites

  • Are you running the latest version of this application?
  • Have you checked the Frequently Asked Questions document?
  • Have you simplified the bug report to the essential details?
    • Do you have a distinct command line to report?
    • Can you clearly state the configuration for this bug report?
    • Do you have a minimal document that highlights this bug?
    • Are any required files (configuration or Markdown document) attached to the issue?
  • Did you perform a cursory search of other issues to look for related issues?

Bug Report

Opening a separate issue as requested by @jackdewinter at #1208 (comment)

Bug Type

  • Assertion Failure
  • Documentation
  • Scan/Rule not working as expected
  • Fix/Rule not working as expected
  • Other

Description

A pyml comment isn't recognised as a not empty line for the purpose of MD022. Instead the comment line isn't counted, and so any empty line after it is seen as an additional contiguous empty line.

So a fragment like:

## My header

<!-- pyml disable-num-lines 3 md011,md013-->

Some long lines

Lead to: MD022: Headings should be surrounded by blank lines. [Expected: 1; Actual: 2; Below] (blanks-around-headings,blanks-around-headers)

Specifics

What operating system and version are you running into this behavior on?

Ubuntu 24.04.1

What version are you seeing this behavior in? (Run pip list or pipenv run pip list and look for the entry beside pymarkdownlnt.)

0.9.25

Are there any extra steps that need to be taken before executing the application?

No

What is the command line you invoke to get this behavior?

paymarkdown scan filename.md

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.

No

What Markdown document causes this behavior to manifest? Attach that file to this issue.

# My header

<!-- pyml disable-num-lines 3 md011,md013-->

Some long lines

Actual Behavior

filename.md:1:1: MD022: Headings should be surrounded by blank lines. [Expected: 1; Actual: 2; Below] (blanks-around-headings,blanks-around-headers)

Expected Behavior

Clean scan

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions