[GH-ISSUE #734] MD049: Incorrectly detecting [[_TOC_]] #2374

Open
opened 2026-03-07 20:07:10 +03:00 by kerem · 4 comments
Owner

Originally created by @Prefix42 on GitHub (Mar 3, 2023).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/734

Problem Description

Rule MD049 incorrectly detects the the Azure Devops markdown tag to auto generate a table of contents

Issue

Azure Devops uses the tag [[_TOC_]] to auto generate a table of contents at render. The tag must match case and syntax exactly or will be rendered as the litteral text. As the tag uses a prefix and suffix of underscore (_) the rule MD049 incorrectly detects the use of underscore as the emphasis style of the document.

Proposal

Exclude "[[TOC]]" from emphasis evaluation

Impacted version(s)

v0.27.0

Supporting Documentation

Markdown syntax for wikis

Originally created by @Prefix42 on GitHub (Mar 3, 2023). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/734 # Problem Description Rule MD049 incorrectly detects the the Azure Devops markdown tag to auto generate a table of contents # Issue Azure Devops uses the tag `[[_TOC_]]` to auto generate a table of contents at render. The tag must match case and syntax exactly or will be rendered as the litteral text. As the tag uses a prefix and suffix of underscore (_) the rule MD049 incorrectly detects the use of underscore as the emphasis style of the document. # Proposal Exclude "[[_TOC_]]" from emphasis evaluation # Impacted version(s) [v0.27.0](https://github.com/DavidAnson/markdownlint/releases/tag/v0.27.0) # Supporting Documentation [Markdown syntax for wikis](https://learn.microsoft.com/en-us/azure/devops/project/wiki/wiki-markdown-guidance?view=azure-devops#table-of-contents-toc-for-wiki-pages)
Author
Owner

@DavidAnson commented on GitHub (Mar 3, 2023):

This construct is not part of the CommonMark specification, so it is reasonable for it to be flagged. That said, your example does not seem to generate a violation: https://dlaa.me/markdownlint/#%25m%23%20Issue%20734%0A%0A%5B%5B_TOC_%5D%5D%0A

<!-- gh-comment-id:1452873231 --> @DavidAnson commented on GitHub (Mar 3, 2023): This construct is not part of the CommonMark specification, so it is reasonable for it to be flagged. That said, your example does not seem to generate a violation: https://dlaa.me/markdownlint/#%25m%23%20Issue%20734%0A%0A%5B%5B_TOC_%5D%5D%0A
Author
Owner

@Prefix42 commented on GitHub (Mar 3, 2023):

Thank you for the super prompt response.

My apologies for the poor explanation and lack of example. Please see the following for a better demonstration of the issue.
https://dlaa.me/markdownlint/#%25m%23%20Issue%20734%0A%0A%5B%5B_TOC_%5D%5D%0A%0Afoo%0A_bar_%0A

In regards to being outside of the CommonMark specification I completely understand but figured it never hurts to ask,

<!-- gh-comment-id:1452881396 --> @Prefix42 commented on GitHub (Mar 3, 2023): Thank you for the super prompt response. My apologies for the poor explanation and lack of example. Please see the following for a better demonstration of the issue. https://dlaa.me/markdownlint/#%25m%23%20Issue%20734%0A%0A%5B%5B_TOC_%5D%5D%0A%0A*foo*%0A_bar_%0A In regards to being outside of the CommonMark specification I completely understand but figured it never hurts to ask,
Author
Owner

@DavidAnson commented on GitHub (Mar 3, 2023):

Thank you! I don't like adding special cases for weird stuff like this, but I see why it's annoying in your scenario. I'll leave this open to think about.

<!-- gh-comment-id:1452896692 --> @DavidAnson commented on GitHub (Mar 3, 2023): Thank you! I don't like adding special cases for weird stuff like this, but I see why it's annoying in your scenario. I'll leave this open to think about.
Author
Owner

@ElCuboNegro commented on GitHub (Jun 13, 2024):

Almost the same with wikilinks. they have a foo [[bar]] foo syntax that is incorrectly flagged as MD052/reference-links-images

<!-- gh-comment-id:2164584079 --> @ElCuboNegro commented on GitHub (Jun 13, 2024): Almost the same with wikilinks. they have a `foo [[bar]] foo` syntax that is incorrectly flagged as MD052/reference-links-images
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#2374
No description provided.