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

MD020 triggered by headings that end with an escaped # #1302

Open
9 of 13 tasks
rdipardo opened this issue Jan 4, 2025 · 1 comment
Open
9 of 13 tasks

MD020 triggered by headings that end with an escaped # #1302

rdipardo opened this issue Jan 4, 2025 · 1 comment

Comments

@rdipardo
Copy link

rdipardo commented Jan 4, 2025

Prerequisites

Bug Report

Please replace any of [these areas] in the paragraphs below with the requested information.

Bug Type

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

Description

A heading such as ## Intro to C\# violates Rule MD020.

The correct scenarios for MD020 currently don't provide an example of this particular case. However, escaped hashes are not markup tokens and probably should not be interpreted as Atx-style heading delimiters.

For comparison, markdownlint implements a more relax version of MD020 that anticipates escaped hashes in line-end position: markdownlint/markdownlint@b2529c6

Specifics

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

Linux debian 6.1.0-28-amd64 #‌1 SMP PREEMPT_DYNAMIC Debian 6.1.119-1 (2024-11-22) x86_64 GNU/Linux

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.26

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?

pymarkdownlnt scan MD020.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.

N/A

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

# MD020

<!-- Escaped hash at end of line -->

## Intro to C\#

Emits MD020 warning.

<!-- Escaped hash followed by punctuation -->

### Intro to C\#, continued

Emits nothing.

<!--  Escaped hash followed by a space -->

## Intro to C\# programming

Emits nothing.

Actual Behavior

The escaped hash at the end of line 5 is interpreted as the closure of an Atx-style heading:

MD020.md:5:16: MD020: No space present inside of the hashes on a possible Atx Closed Heading. (no-missing-space-closed-atx)

Expected Behavior

No warnings.

@jackdewinter
Copy link
Owner

just fixed this. how are you accessing the PyMarkdown linter? From a Python package or through a pre-commit hook?

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