vsch / idea-multimarkdown

Markdown language support for IntelliJ IDEA.
https://plugins.jetbrains.com/plugin/7896-markdown-navigator
Apache License 2.0
813 stars 129 forks source link

Unresolved reference Reference with text in square brackets #822

Open InvisibleSmiley opened 4 years ago

InvisibleSmiley commented 4 years ago

Text in square brackets is annotated with error "Unresolved reference Reference".

PhpStorm's default Markdown plugin doesn't classify this as an error (or warning).

AFAICT it is valid Markdown to put text in square brackets without making it a link. All viewers/renderers I've tested are OK with it, too. I couldn't find any source that states that if something is put in square brackets it must be a link - on the contrary of course, if the prerequisites for a link (inline ref or ref defined elsewhere in the document) are fulfilled, it should be considered a link.

Markdown Navigator currently handles such cases as errors.

Example:

# [1.2.3]
foo [bar]

Options to resolve this issue (in order of my preference): a) don't recognize such text as an error at all b) add an option to ignore such cases and make it the default to ignore them c) add an option to ignore such cases and make it the default to not ignore them

In any case I'd like to have a way to not have to enable something for each project I'm working on.

vsch commented 4 years ago

@InvisibleSmiley, the plugin has no way of telling whether you are missing a reference definition or simply using square brackets since Markdown has no syntax errors. Anything which is not defined is simply treated as text.

You can disable reference validation inspection and also annotation settings:

image

image

In a future release I will remove the annotator setting and only use the inspection setting to avoid the duplication.

If you only want to disable validation of text in square brackets for some patterns and leave it for others, then see #767 for configuring link map settings to do this.

You can save the plugin settings and inspection settings as defaults so you would only need to configure it once per IDE type.

InvisibleSmiley commented 4 years ago

Thanks for the pointer toward #767 - since it supports regexps this might suffice as a workaround in case I need one.

Not sure about the defaults though since AFAIK they only serve as templates for new projects and don't affect existing ones (of which I have many).

Disabling reference validation doesn't sound like something I would want to do. After all if a text in square brackets is actually a link (i.e. has a link target definition attached to it) I do want to have the link target validated. I just want to have the ability to disable checking potential links, i.e. those missing a link target definition.

Anyway, the main reason I stumbled over this issue is because me and my team misunderstood the keepachangelog example, thinking that they put versions in square brackets for fun. We missed that the keepachangelog example contains link target definitions at the end... So as a workaround I started to remove the square brackets from version numbers that I never intended to linkify.