Markdown ignoreLink should apply to paths in header links (#150223)

This change lets you ignore all links to a given file, even if those links include a header. For example: `[text](/path/to/file#some-header)` can be ignored using `/path/to/file`
This commit is contained in:
Matt Bierner
2022-05-23 17:07:15 -07:00
committed by GitHub
parent 6a9108155f
commit 1c7991f1e8
2 changed files with 13 additions and 1 deletions

View File

@@ -494,7 +494,7 @@ export class DiagnosticComputer {
if (fragmentLinks.length) {
const toc = await TableOfContents.create(this.engine, hrefDoc);
for (const link of fragmentLinks) {
if (!toc.lookup(link.fragment) && !this.isIgnoredLink(options, link.source.text)) {
if (!toc.lookup(link.fragment) && !this.isIgnoredLink(options, link.source.pathText) && !this.isIgnoredLink(options, link.source.text)) {
const msg = localize('invalidLinkToHeaderInOtherFile', 'Header does not exist in file: {0}', link.fragment);
diagnostics.push(new LinkDoesNotExistDiagnostic(link.source.hrefRange, msg, severity, link.source.text));
}