Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to provide ignore a list of reference links #304

Closed
jerrens opened this issue Oct 2, 2023 · 4 comments
Closed

Ability to provide ignore a list of reference links #304

jerrens opened this issue Oct 2, 2023 · 4 comments
Labels

Comments

@jerrens
Copy link

jerrens commented Oct 2, 2023

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?

Perhaps the requested feature to disable markdown linting of a specific line would be a more universal solution?

Footnotes

  1. https://docs.gitlab.com/ee/user/markdown.html#table-of-contents

@DavidAnson
Copy link
Owner

This project already allows you to ignore individual violations. However, if changing settings under markdown.validate are able to fix your problem, then your issue is with VS Code and not this extension. You can confirm that by disabling this extension temporarily. If the issue remains, please open an issue with the editor instead.

@jerrens
Copy link
Author

jerrens commented Oct 2, 2023

Thank you for the quick response @DavidAnson.

I could not find the correct syntax to disable this particular violation for just a single line. The error code link.no-such-referenced isn't tied to a particular MDnnn rule that I am familiar with referencing. Perhaps there is a syntax I'm not familiar with that you can suggest for this particular error?

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
}]

@DavidAnson
Copy link
Owner

You seem to be complaining about about the VS Code feature described here: https://code.visualstudio.com/docs/languages/markdown#_link-validation

You can confirm that by disabling or uninstalling the markdownlint extension to confirm the issue is still present without it.

@jerrens
Copy link
Author

jerrens commented Oct 2, 2023

Ah. My mistake! You are correct, this is being triggered by the built-in VS Code feature and not your extension.

If anyone ends up here looking for the same thing I was, a ticket was opened here: microsoft/vscode-markdown-languageservice#152

@jerrens jerrens closed this as completed Oct 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants