oleeskild / obsidian-digital-garden

MIT License
1.42k stars 128 forks source link

[Feature Request] Option to remove unresolved links #333

Open FelipeSharkao opened 1 year ago

FelipeSharkao commented 1 year ago

I'm using digital garden to share details of my RPG setting, and part of my note-taking process is creating many links in each note for topics I want to develop later. Also, not all of my Obsidian notes will go to the digital garden.

This unresolved links create a confusing environment for someone that doesn't know how Obsidian works (most of the people I'll be showing this). Currently, I add a custom component for removing links with the is-unresolved class, but I would like if this was an option that worked during build.

FelipeSharkao commented 1 year ago

Looking the code, I noticed this bit on the 11ty link filter

if(deadLink){
  return `<a class="internal-link is-unresolved" href="/404">${title}</a>`;
}
return `<a class="internal-link data-note-icon="${noteIcon}" href="${permalink}${headerLinkPath}">${title}</a>`;

Probably it would be the place to do this

if (deadLink) {
  if (unresolvedLink) {
    return `<a class="internal-link is-unresolved" href="/404">${title}</a>`;
  }
  return title;
}
return `<a class="internal-link data-note-icon="${noteIcon}" href="${permalink}${headerLinkPath}">${title}</a>`;

ignoreUnresolvedLink could come from frontmatter, something like dg-unresolved-links (defaulting to true)