Confirm note creation when clicking link

Use case or problem

When you click a link that has no note under it, the new note is automatically created and opened.
Link with no note under it can appear in cases:

  1. Link is misspelled
  2. Link is made expecting to fill information under it later
  3. Some problems with synchronisztion happend when a note was renamed so that the link to it was not properely updates

In all this cases an immidiate new note creation is wrong. You can click a link with no intention to write anything, but just to see information under it. In cases (1) and (3) creation a new note file is an error, user just have to fix link. In case (2) creation on note before user is ready to fill it results in leak of informetion that the link is still not pointing to any information.

Proposed solution

Confirmation window should be displayed before new note creation when user clicks a link with no note under it.

Current workaround (optional)

You have to delete a newly created note every time when it was unexpectingy created

Related feature requests (optional)

Failed to find any

13 Likes

To edit a link without following it, press and hold the OPT key before clicking on the link.

That’s true, and helpful to know. But that only works if you already know you don’t want to follow the link. ovod listed 2 ways that a mistake could be made, and you might not notice until after you clicked. (Also… I just noticed if you alt-click on a link, multiple cursors get activated. Might have to raise a bug about that.)

Another workaround would be to use a CSS snippet to make empty links an even more obvious colour. Right now, they are slightly dim. You could make them a bright warning color, so you know that clicking it would make a new note.

Or here is an example, where I make the underline squiggly.

screenshot_2023-03-12_03-57-12

Add a color if you want it even more obvious:

.markdown-source-view.mod-cm6 .is-unresolved {
    color: red;
    font-style: italic;
    text-decoration-style: wavy;
    text-decoration-line: underline;
}   

But workarounds aside, I think this is a good FR. +1.

Don’t understand how anyone clicks a link without knowing that they want to click a link (unless they have a motor disorder or a faulty mouse / trackpad), and I understood the OP to say that they specifically elect to click on links to edit them … in which case they just need to use the modifier key.

My bad if I misunderstood and still misunderstand.

I really hope any modal asking if people want to follow a link or create a new file is optional. For me that would be an unnecessary step because I know the difference of how to click on a link to edit or follow it, and so far I have never accidentally clicked on a link and been taken away from what I intended to do.

Good to have options and ideas.

1 Like

I agree with you that it should be an option, especially if it results in a popup. Just like “confirm file deletion” option. Personally, I wouldn’t use it. I am going to try to color empty links with CSS. But I still think it’s a good FR.

You don’t need to agree with the request. But please don’t imply people have a motor disorder, faulty equipment, or a lack of knowledge.

I’m not going to perjure myself for the sake of other people’s misunderstandings and / or misinterpretations; and this is a forum where lots of people with a lack of knowledge (including me) come and ask for help.

People deliberately click on links to follow them or edit them.

If they don’t know the modifier key to be able to edit them, they have a lack of knowledge.

If they click on links accidentally, they probably have some kind of motor issues (as my father has); a glitch with their hardware or software (as I did with the trackpad on my last and now replaced MBP); or they have some other issue that is causing them to click erratically.

If I have missed something out, fair enough. But the suggestions I made are fair, rational, honest, and logical. Obfuscating those likely causes helps no one, IMO.

If you were being ironic, I missed it. My bad.

Enjoy the week ahead.

I see this proposed option being helpful in at least three instances:

  1. You click a link thinking it’ll take you to one that already exists but realize there was a typo and now you’re in a new note instead.
  2. Your theme doesn’t clearly distinguish between existing and non-existing links.
  3. You want to guard against premature creation of a note (e.g., a link to a future daily note) and the resulting hassle of undoing it in instances where an accidental tap may easily occur (such as scrolling through an existing daily note on a mobile device).

Also worth noting that the Option-click method you proposed for editing a link is not an option on iOS.

3 Likes

I’d also like to see this implemented natively or a plugin. It’s inconvenient to every now and then find notes which were accidentally created by clicking non-existing note links or nodes in a graph. Finding these stray notes isn’t always easy either since they usually contain some front matter and therefore aren’t 0 KB.

1 Like

The confirmation is quite important since the behavior of creating notes out of a link is very surprising if you’re mistaken about what’s possible.

For example, what if a user mistakenly believe it is possible to link to a directory?

  • [[/path/to/folder/]] resolves to a new note folder.md being created.
  • [[/path/to/folder/]] and [[/path/to/folder]] resolve to two different files. Even worse it is not a file name folder.md vs folder/.md. It is folder 1.md (WHAT?!)

I strongly disagree with @anon63144152 . The existing behavior makes it too easy to make mistakes.

The clicking on links that point to non-existing files is a massive nuisance for me and I can’t believe it creates a new MD file (and folders!) unprompted/with no option to stop it from doing that. I would far prefer for a little popup message to say “invalid link” or “file does not exist”.

I have converted a bunch of html files to md, and these files include links. These (relative) links point to parts of the original website and obviously don’t work in obsidian. Here is an example of one such link: [Bumblebees](/bugs/flying/bumble-bees.html "Bumble bees in nature")

If I click on the above link accidentally (say I’m on mobile and my fat finger presses it accidentally, or if not concentrated and think the link exists because it’s not super obvious it doesn’t) it will create new folders /bugs/flying/ and a new file bumble-bees.html.md.

Eventually I’m planning to modify these links to point to the right MD file e.g. [Bumblebees](/Bees/Bumblebees.md) but in the interim I’m pretty bummed. I’d be more than happy for a link to be dead, rather than for it to generate an empty file in my vault.

I’m almost tempted to write a script to modify all my “dead links” such that they point towards a “dump” folder, that way if I accidentally click the link the new file will end up in the dump folder and I’ll be able to bulk delete them periodically.

I’ll just reply with a reminder about how I style non-existent links using CSS. I make my links squiggly-underlined and orange when they don’t exist.

(I’m not dismissing this feature request. I think it would be great. But I personally enjoy this workaround.)

CSS Snippet (for Wikilinks anyway. I’m not sure about Markdown links, sorry!):

.markdown-source-view.mod-cm6 .is-unresolved {
    color: orange;
    font-style: italic;
    text-decoration-style: wavy;
    text-decoration-line: underline;
}   

Result:

screenshot_2023-11-22_11-09-46

1 Like

A slight variation of @rigmarole’s useful snippet which also works with the reading view (assumes the default theme):

Obsidian_2023-11-22_19-24-43

:is(.markdown-reading-view, .markdown-source-view) .is-unresolved {
    color: var(--color-pink) !important;
    text-decoration-color: var(--color-pink) !important;
    text-decoration-line: underline;
    text-decoration-style: wavy !important;
}
1 Like

It shouldn’t be possible to create folder/.md/ is a forbidden filename character on all popular OSes.