mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2026-04-25 17:26:22 +03:00
[GH-ISSUE #511] MD034 is triggered when it is not supposed to #2266
Labels
No labels
bug
enhancement
enhancement
enhancement
fixed in next
fixed in next
fixed in next
new rule
new rule
new rule
pull-request
question
refactoring
refactoring
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/markdownlint#2266
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @techmagus on GitHub (Mar 25, 2022).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/511
Hi,
There are some instances wherein MD034 is triggered when it is not supposed to (at least as per documentation).
Sample file:
Before the trigger: access-google-ipv6.md
Snippet:
aside: The md content was transferred from an old platform so it is not yet converted to markdown. Currently doing minor edits / passes when I noticed this bug(?).
After the trigger: access-google-ipv6.md
Snippet:
Some triggers MD034 (
< >are added) while some not.Initially I thought it triggers when there is no trailing slash, however, there are URLs with a trailing slash that still gets edited by MD034.
Example:
Is turned into:
As a temporary workaround, I disabled MD034 but of course it means I won't get alerts about bare URLs.
My settings.json:
Versions:
I hope I've provided all the necessary information.
Thank you. Shalom!
@DavidAnson commented on GitHub (Mar 25, 2022):
There are two things going on:
Let's start with the first. Here's a simple demonstration of the issue: https://dlaa.me/markdownlint/#%25m%23%20Issue%20235%0A%0AText%20%3Ca%20href%3D%E2%80%9Chttps%3A%2F%2Fexample.com%2Fone%E2%80%9D%3Ehttps%3A%2F%2Fexample.com%2Ftwo%3C%2Fa%3E%20text%0A
As you can see, the bare URL being reported is the one used for the text of the A tag, not the one being used for the link. There is room for discussion, but I claim that is indeed a bare URL because it is not part of a Markdown link or surrounded by angle brackets. Applying the automatic fix for this scenario does what's expected and addresses the violation.
Your scenario uses the same URL for both link and text and that confuses the fix, but arguably the preferred way to express your scenario is a single URL surrounded by angle brackets which avoids MD034 and MD033 and the duplication seen in your example where the two links don't always match.
@techmagus commented on GitHub (Mar 27, 2022):
Ahh! Got it! Thank you for the explanation and the demo link (very useful).
Shalom!