-
Notifications
You must be signed in to change notification settings - Fork 74
Open
Labels
Description
Environment
ESLint version: 9.31.0
@eslint/markdown version: 7.0.0
Node version: 22.15.0
npm version: 10.9.2
Operating System: Ubuntu 24.04
Which language are you using?
gfm
What did you do?
Configuration
import { defineConfig } from "eslint/config";
import markdown from "@eslint/markdown";
export default defineConfig({
files: ["**/*.md"],
plugins: { markdown },
language: "markdown/gfm",
rules: {
"markdown/no-multiple-h1": "error",
"markdown/require-alt-text": "error",
},
});
# Heading 1
<h1>Reported</h1>
<!-- --> <h1>Not reported</h1>
---
<img src="reported.png" />
<!-- --> <img src="not-reported.png" />
What did you expect to happen?
With no-multiple-h1: error
the substring <h1>Not reported</h1>
should be reported.
With require-alt-text: error
the substring <img src="not-reported.png" />
should be reported.
What actually happened?
Neither is reported.
Link to Minimal Reproducible Example
Participation
- I am willing to submit a pull request for this issue.
Additional comments
For both this is due to the regular subexpression (?<!<!--[\s\S]*?)<
, which does not end after the closing -->
.
markdown/src/rules/no-multiple-h1.js
Line 27 in 56eb0ee
const h1TagPattern = /(?<!<!--[\s\S]*?)<h1[^>]*>[\s\S]*?<\/h1>/giu; markdown/src/rules/require-alt-text.js
Line 27 in 56eb0ee
const imgTagPattern = /(?<!<!--[\s\S]*?)<img[^>]*>/giu;
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Implementing