microsoft / microsoft/vscode-markdown-languageservice

Ability to provide an ignore list of reference links for markdown validation

Open
#152 8 comments 29 reactions 1 assignee View on GitHub

@mjbvz is already working on this.

Since Oct 2, 2023.

feature-request
Dominant language
TypeScript
Stars
438
Forks
25
Avg merge
3d 21h
Merged PRs (30d)
1

Description

When creating a README.md file for a GitLab repo, I received the following validation error after adding a reference of [TOC] ^1. I recognize this Table of Contents element is a feature extension added by GitLab to the standard Markdown syntax, so there was no surprise that I received the following error: No link definition found: 'TOC'.

While searching for a way to disable or ignore this one error, I ran across https://stackoverflow.com/questions/75252767/have-vscode-ignore-specific-reference-links-in-markdown-validation, but there was no known solution offered.

As suggested in the the SO thread, it would be nice if there was a way to ignore just this one 'TOC' entry via an ignore list, instead of having to to completely disable reference link validation (with "markdown.validate.referenceLinks.enabled": "ignore") for the whole project.

Is there currently a way to ignore this TOC link that I've missed?

If not possible through some current means, can the reference link validation be modified to also consider entries in the markdown.validate.ignoredLinks list or a separate setting added for providing a list of reference links that should be ignored?

The setting under markdown.validate that I did find (markdown.validate.referenceLinks.enabled) does work, but is not desirable since it turns off all reference link validation for the whole project. What I was hoping for was a way to keep that validation rule enabled, but be able to provide an explicit list of links that would be ignored.

I tried adding the following configuration, but it did not work as I hoped it would:

"markdown.validate.ignoredLinks": [ "TOC" ] 

A little more detail on the specific error reported:

[{
	"resource": "/c:/Projects/..../readme.md",
	"owner": "markdown",
	"code": "link.no-such-reference",
	"severity": 4,
	"message": "No link definition found: 'TOC'",
	"startLineNumber": 17,
	"startColumn": 2,
	"endLineNumber": 17,
	"endColumn": 5
}]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.