Prevent creation of new files when clicking link to unknown files

I’ve seen a couple people have asked this question buyt no fully resolved solution was provided. Based on one of the answers by an anonymous user, I was able to expand their CSS part solution to fully achieve this requirement of making the links unclickable.

Changing those links to a red colour is optional, but I’ve used it because it’s the traditional web colour for broken links.

Create a css snippet file (Settings > Appearance > CSS Snippets) and paste this CSS into it

body {
    --link-unresolved-decoration-color: #f00;
    --link-unresolved-color: #f00;
}

.markdown-source-view.mod-cm6.is-live-preview .cm-hashtag.cm-meta, 
.markdown-source-view.mod-cm6 .cm-hmd-internal-link .cm-underline, 
.markdown-source-view.mod-cm6 .cm-link .cm-underline, 
.markdown-source-view.mod-cm6 .cm-url .cm-underline,
.metadata-container .internal-link.is-unresolved, 
.markdown-rendered .internal-link.is-unresolved {
    pointer-events: none;
}

attn: @jms @CawlinTeffid @retgits

3 Likes

Note: You can override this by holding cmd/ctrl when clicking the link in edit mode.

1 Like