[GH-ISSUE #486] MD049/50: Incorrect range/fixinfo if identical errors on the same line #2248

Closed
opened 2026-03-07 20:05:59 +03:00 by kerem · 1 comment
Owner

Originally created by @Billiam on GitHub (Jan 19, 2022).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/486

Example:

**a** __b__ __b__

The above will generate two errors for inconsistent strong style for the two __b__ elements, but both errors will share the same range and fixinfo, pointing to only the first instance.

Obviously markdown-it doesn't provide this information with the token, and that range info comes from helpers.getRangeAndFixInfoIfFound, which just uses indexOf against the markdown line. This works fine as long as the elements don't have identical content like above.

Instead, I think getRangeAndFixInfoIfFound could accept an offset or instance number instead of only returning info for the first result.

I assume this affects other inline checks but I'm not sure which offhand.

Originally created by @Billiam on GitHub (Jan 19, 2022). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/486 Example: ```markdown **a** __b__ __b__ ``` The above will generate two errors for inconsistent strong style for the two `__b__` elements, but both errors will share the same range and fixinfo, pointing to only the first instance. Obviously markdown-it doesn't provide this information with the token, and that range info comes from `helpers.getRangeAndFixInfoIfFound`, which just uses `indexOf` against the markdown line. This works fine as long as the elements don't have identical content like above. Instead, I think `getRangeAndFixInfoIfFound` could accept an offset or instance number instead of only returning info for the first result. I assume this affects other inline checks but I'm not sure which offhand.
kerem 2026-03-07 20:05:59 +03:00
Author
Owner

@DavidAnson commented on GitHub (Jan 19, 2022):

Agree, but I expect this is unlikely in practice. And if it does come up, the next iteration will fix that second violation.

<!-- gh-comment-id:1016854090 --> @DavidAnson commented on GitHub (Jan 19, 2022): Agree, but I expect this is unlikely in practice. And if it does come up, the next iteration will fix that second violation.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/markdownlint#2248
No description provided.