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

Common DocFx [!NOTE] notation being flagged with verify links #164

Closed
MicroTuld opened this issue Dec 12, 2023 · 4 comments
Closed

Common DocFx [!NOTE] notation being flagged with verify links #164

MicroTuld opened this issue Dec 12, 2023 · 4 comments
Labels
bug Issue identified by VS Code Team member as probable bug help wanted Issues identified as good community contribution opportunities

Comments

@MicroTuld
Copy link

With DocFx, a common syntax is:

> [!NOTE]
> This is a special note box.

but verification is flagging this with "No link definition found" (link.no-such-reference). This seems to be because () is expected.

I would like to continue using link verification, but the only override available seems to be for what is inside the (), not the [].

This issue seems to be similar to #152

@lucaspar
Copy link

lucaspar commented Mar 1, 2024

Agreed - I suggest updating the issue title to cover all Markdown alerts, something like

Markdown alerts cause false positives from link detection feature (link.no-such-reference).

That should cover at least [!NOTE], [!TIP], [!IMPORTANT], [!CAUTION], and [!WARNING] but perhaps this could be safely generalized for any "links" that start with a bang !.

@lucaspar
Copy link

lucaspar commented Mar 1, 2024

It seems this is the block that needs to change - if any devs want to take on this task:

/**
* Matches `[text][ref]` or `[shorthand]` or `[shorthand][]`
*/
const referenceLinkPattern = new RegExp(
r`(^|[^\]\\])` + // Must not start with another bracket (workaround for lack of support for negative look behinds)
r`(?:` +
/**/r`(?:` +
/****/r`(` + // Start link prefix
/******/r`!?` + // Optional image ref
/******/r`\[((?:` +// Link text
/********/r`\\\]|` + // escaped bracket, or...
/********/r`[^\[\]]|` + //non bracket char, or...
/********/r`\[[^\[\]]*\]` + // matched bracket pair
/******/`+)*)\]` + // end link text
/******/r`\[\s*?` + // Start of link def
/****/r`)` + // end link prefix
/****/r`(` +
/******/r`[^\]]*?)\]` + //link def
/******/r`|` +
/******/r`\[\s*?([^\\\]]*?)\s*\])(?![\(])` +
r`)`,
'gm');

@mjbvz
Copy link
Contributor

mjbvz commented Mar 28, 2024

I'm good with adding a special case for [! refs. Spec wise you can write:

[!NOTE]

[!NOTE]: http://example.com

but it's likely not common

@mjbvz mjbvz added bug Issue identified by VS Code Team member as probable bug help wanted Issues identified as good community contribution opportunities labels Mar 28, 2024
MODUSCarstenScholling added a commit to MODUSCarstenScholling/vscode-markdown-languageservice that referenced this issue Oct 24, 2024
mjbvz added a commit that referenced this issue Oct 29, 2024
@mjbvz
Copy link
Contributor

mjbvz commented Oct 29, 2024

Fixed by #191

@mjbvz mjbvz closed this as completed Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug help wanted Issues identified as good community contribution opportunities
Projects
None yet
Development

No branches or pull requests

3 participants