[GH-ISSUE #511] MD034 is triggered when it is not supposed to #2266

Closed
opened 2026-03-07 20:06:09 +03:00 by kerem · 2 comments
Owner

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:

* Google Sites: <a href="https://sites.google.com" rel="noopener external nofollow">https://sites.google.com</a>
* Google Translate: <a href="https://translate.google.com" rel="noopener external nofollow">https://translate.google.com</a>
* Google Earth: <a href="https://www.google.com/earth/" rel="noopener external nofollow">https://earth.google.com</a>
* Google Moderator: <span class="popper animate removed_link" data-popper="https://moderator.appspot.com">https://web.archive.org/web/20150621104346/https://moderator.appspot.com/</span>
* Google FeedBurner: <a href="https://accounts.google.com/ServiceLogin?service=feedburner&amp;continue=https%3A%2F%2Ffeedburner.google.com%2Ffb%2Fa%2Fmyfeeds&amp;gsessionid=u9hHPZko-UNXqdtUCdPKIg" rel="noopener external nofollow">https://feedburner.google.com</a>
* Google YouTube: <a href="https://www.youtube.com/supported_browsers?next_url=%2F" rel="noopener external nofollow">https://youtube.com</a>
* Google App Engine: <a href="https://appengine.google.com" rel="noopener external nofollow">https://appengine.google.com</a>
* Google Code: <a href="https://code.google.com" rel="noopener external nofollow">https://code.google.com</a>
* Google Docs: <a href="https://docs.google.com" rel="noopener external nofollow">https://docs.google.com</a>
* Google Health: <a href="https://www.google.com/intl/en_us/health/about/" rel="noopener external nofollow">https://health.google.com</a>

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:

- Google Sites: <a href="<https://sites.google.com>" rel="noopener external nofollow">https://sites.google.com</a>
- Google Translate: <a href="<https://translate.google.com>" rel="noopener external nofollow">https://translate.google.com</a>
- Google Earth: <a href="https://www.google.com/earth/" rel="noopener external nofollow"><https://earth.google.com></a>
- Google Moderator: <span class="popper animate removed_link" data-popper="https://moderator.appspot.com"><https://web.archive.org/web/20150621104346/https://moderator.appspot.com/></span>
- Google FeedBurner: <a href="https://accounts.google.com/ServiceLogin?service=feedburner&amp;continue=https%3A%2F%2Ffeedburner.google.com%2Ffb%2Fa%2Fmyfeeds&amp;gsessionid=u9hHPZko-UNXqdtUCdPKIg" rel="noopener external nofollow"><https://feedburner.google.com></a>
- Google YouTube: <a href="https://www.youtube.com/supported_browsers?next_url=%2F" rel="noopener external nofollow"><https://youtube.com></a>
- Google App Engine: <a href="<https://appengine.google.com>" rel="noopener external nofollow">https://appengine.google.com</a>
- Google Code: <a href="<https://code.google.com>" rel="noopener external nofollow">https://code.google.com</a>
- Google Docs: <a href="<https://docs.google.com>" rel="noopener external nofollow">https://docs.google.com</a>
- Google Health: <a href="https://www.google.com/intl/en_us/health/about/" rel="noopener external nofollow"><https://health.google.com></a>

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:

* Google Reader: <a href="https://www.google.com/reader/about/" rel="noopener external nofollow">https://www.google.com/reader/</a>

Is turned into:

- Google Reader: <a href="<https://www.google.com/reader/>about/" rel="noopener external nofollow">https://www.google.com/reader/</a>

As a temporary workaround, I disabled MD034 but of course it means I won't get alerts about bare URLs.

My settings.json:

{
  "auto-close-tag.SublimeText3Mode": true,
  "autoprefixer.formatOnSave": true,
  "editor.acceptSuggestionOnEnter": "smart",
  "editor.bracketPairColorization.enabled": true,
  "editor.codeActionsOnSave": {
    "source.fixAll.markdownlint": true
  },
  "editor.fontFamily": "'Noto Mono', 'Noto Sans Mono', 'monospace', monospace",
  "editor.linkedEditing": true,
  "editor.renderWhitespace": "all",
  "editor.rulers": [70, 80, 100, 120],
  "editor.showFoldingControls": "always",
  "editor.tabSize": 2,
  "editor.wordWrap": "on",
  "editor.wrappingIndent": "deepIndent",
  "explorer.autoReveal": false,
  "files.trimTrailingWhitespace": true,
  "html.autoClosingTags": false,
  "html.autoCreateQuotes": false,
  "markdownlint.config": {
    "default": true,
    "MD003": {
      "style": "atx"
    },
    "MD004": {
      "style": "dash"
    },
    "MD029": {
      "style": "one_or_ordered"
    },
    "MD033": {
      "allowed_elements": [
        "bdi",
        "bdo",
        "cite",
        "del",
        "ins",
        "mark",
        "q",
        "rb",
        "rbc",
        "rp",
        "rt",
        "ruby",
        "span",
        "sub",
        "sup"
      ]
    },
    "MD035": {
      "style": "---"
    },
    "MD046": {
      "style": "fenced"
    },
    "MD048": {
      "style": "backtick"
    },
    "MD049": {
      "style": "asterisk"
    },
    "MD050": {
      "style": "asterisk"
    }
  },
  "minify.minifyExistingOnSave": true,
  "redhat.telemetry.enabled": false,
  "todo-tree.general.enableFileWatcher": true,
  "todo-tree.highlights.useColourScheme": true,
  "window.zoomLevel": -0.5,
  "workbench.colorTheme": "Mayukai Semantic Mirage",
  "workbench.editor.closeEmptyGroups": false,
  "workbench.editor.enablePreview": false,
  "workbench.iconTheme": "material-icon-theme",
  "workbench.sideBar.location": "right"
}

Versions:

  • VScode: 1.65.2
  • markdownlint: 0.46.0

I hope I've provided all the necessary information.

Thank you. Shalom!

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](https://github.com/DavidAnson/vscode-markdownlint/files/8346538/access-google-ipv6.md) Snippet: ```html * Google Sites: <a href="https://sites.google.com" rel="noopener external nofollow">https://sites.google.com</a> * Google Translate: <a href="https://translate.google.com" rel="noopener external nofollow">https://translate.google.com</a> * Google Earth: <a href="https://www.google.com/earth/" rel="noopener external nofollow">https://earth.google.com</a> * Google Moderator: <span class="popper animate removed_link" data-popper="https://moderator.appspot.com">https://web.archive.org/web/20150621104346/https://moderator.appspot.com/</span> * Google FeedBurner: <a href="https://accounts.google.com/ServiceLogin?service=feedburner&amp;continue=https%3A%2F%2Ffeedburner.google.com%2Ffb%2Fa%2Fmyfeeds&amp;gsessionid=u9hHPZko-UNXqdtUCdPKIg" rel="noopener external nofollow">https://feedburner.google.com</a> * Google YouTube: <a href="https://www.youtube.com/supported_browsers?next_url=%2F" rel="noopener external nofollow">https://youtube.com</a> * Google App Engine: <a href="https://appengine.google.com" rel="noopener external nofollow">https://appengine.google.com</a> * Google Code: <a href="https://code.google.com" rel="noopener external nofollow">https://code.google.com</a> * Google Docs: <a href="https://docs.google.com" rel="noopener external nofollow">https://docs.google.com</a> * Google Health: <a href="https://www.google.com/intl/en_us/health/about/" rel="noopener external nofollow">https://health.google.com</a> ``` 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](https://github.com/DavidAnson/vscode-markdownlint/files/8346556/access-google-ipv6.md) Snippet: ```html - Google Sites: <a href="<https://sites.google.com>" rel="noopener external nofollow">https://sites.google.com</a> - Google Translate: <a href="<https://translate.google.com>" rel="noopener external nofollow">https://translate.google.com</a> - Google Earth: <a href="https://www.google.com/earth/" rel="noopener external nofollow"><https://earth.google.com></a> - Google Moderator: <span class="popper animate removed_link" data-popper="https://moderator.appspot.com"><https://web.archive.org/web/20150621104346/https://moderator.appspot.com/></span> - Google FeedBurner: <a href="https://accounts.google.com/ServiceLogin?service=feedburner&amp;continue=https%3A%2F%2Ffeedburner.google.com%2Ffb%2Fa%2Fmyfeeds&amp;gsessionid=u9hHPZko-UNXqdtUCdPKIg" rel="noopener external nofollow"><https://feedburner.google.com></a> - Google YouTube: <a href="https://www.youtube.com/supported_browsers?next_url=%2F" rel="noopener external nofollow"><https://youtube.com></a> - Google App Engine: <a href="<https://appengine.google.com>" rel="noopener external nofollow">https://appengine.google.com</a> - Google Code: <a href="<https://code.google.com>" rel="noopener external nofollow">https://code.google.com</a> - Google Docs: <a href="<https://docs.google.com>" rel="noopener external nofollow">https://docs.google.com</a> - Google Health: <a href="https://www.google.com/intl/en_us/health/about/" rel="noopener external nofollow"><https://health.google.com></a> ``` 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: ```html * Google Reader: <a href="https://www.google.com/reader/about/" rel="noopener external nofollow">https://www.google.com/reader/</a> ``` Is turned into: ```html - Google Reader: <a href="<https://www.google.com/reader/>about/" rel="noopener external nofollow">https://www.google.com/reader/</a> ``` As a temporary workaround, I disabled MD034 but of course it means I won't get alerts about bare URLs. My settings.json: ```json { "auto-close-tag.SublimeText3Mode": true, "autoprefixer.formatOnSave": true, "editor.acceptSuggestionOnEnter": "smart", "editor.bracketPairColorization.enabled": true, "editor.codeActionsOnSave": { "source.fixAll.markdownlint": true }, "editor.fontFamily": "'Noto Mono', 'Noto Sans Mono', 'monospace', monospace", "editor.linkedEditing": true, "editor.renderWhitespace": "all", "editor.rulers": [70, 80, 100, 120], "editor.showFoldingControls": "always", "editor.tabSize": 2, "editor.wordWrap": "on", "editor.wrappingIndent": "deepIndent", "explorer.autoReveal": false, "files.trimTrailingWhitespace": true, "html.autoClosingTags": false, "html.autoCreateQuotes": false, "markdownlint.config": { "default": true, "MD003": { "style": "atx" }, "MD004": { "style": "dash" }, "MD029": { "style": "one_or_ordered" }, "MD033": { "allowed_elements": [ "bdi", "bdo", "cite", "del", "ins", "mark", "q", "rb", "rbc", "rp", "rt", "ruby", "span", "sub", "sup" ] }, "MD035": { "style": "---" }, "MD046": { "style": "fenced" }, "MD048": { "style": "backtick" }, "MD049": { "style": "asterisk" }, "MD050": { "style": "asterisk" } }, "minify.minifyExistingOnSave": true, "redhat.telemetry.enabled": false, "todo-tree.general.enableFileWatcher": true, "todo-tree.highlights.useColourScheme": true, "window.zoomLevel": -0.5, "workbench.colorTheme": "Mayukai Semantic Mirage", "workbench.editor.closeEmptyGroups": false, "workbench.editor.enablePreview": false, "workbench.iconTheme": "material-icon-theme", "workbench.sideBar.location": "right" } ``` Versions: - VScode: 1.65.2 - markdownlint: 0.46.0 I hope I've provided all the necessary information. Thank you. Shalom!
kerem 2026-03-07 20:06:09 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@DavidAnson commented on GitHub (Mar 25, 2022):

There are two things going on:

  1. MD034 is reporting a bare URL in the scenario you show
  2. MD034 is fixing the wrong instance of the URL from above

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.

<!-- gh-comment-id:1078606770 --> @DavidAnson commented on GitHub (Mar 25, 2022): There are two things going on: 1. MD034 is reporting a bare URL in the scenario you show 2. MD034 is fixing the wrong instance of the URL from above 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.
Author
Owner

@techmagus commented on GitHub (Mar 27, 2022):

Ahh! Got it! Thank you for the explanation and the demo link (very useful).

Shalom!

<!-- gh-comment-id:1079907430 --> @techmagus commented on GitHub (Mar 27, 2022): Ahh! Got it! Thank you for the explanation and the demo link (very useful). Shalom!
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#2266
No description provided.