obsidian-dataview icon indicating copy to clipboard operation
obsidian-dataview copied to clipboard

Unresolved link does not have "is_unresolved" CSS class

Open CovetingEpiphany2152 opened this issue 4 years ago • 10 comments

Links being populated by dataview seems to be a tags with internal-link class. If the link is unresolved, the is_unresolved class is missing.

User is unable to differentiate links to files that exists versus unresolved ones when using dataview.

CovetingEpiphany2152 avatar Jun 02 '21 12:06 CovetingEpiphany2152

That's interesting; I use Obsidian's own link rendering! Will have to investigate more.

blacksmithgu avatar Jun 04 '21 22:06 blacksmithgu

I had the same issue in my plugin. When manually creating an internal link, everything else works besides styling unresolved links as such. One can check if a link is unresolved using app.metadataCache.unresolvedLinks[currentFile.path][targetFile.basename] > 0, and then add the is-unresolved class as necessary. However, this doesn't actually style the link as unresolved, even with the class. What I ended up doing was making a custom unresolved class, and just applying a.custom-unresolved { opacity: 0.6 } to simulate the effect

SkepticMystic avatar Jun 20 '21 21:06 SkepticMystic

I'll see if I can do the same. A little annoying based on my code structure but manageable.

blacksmithgu avatar Jul 09 '21 20:07 blacksmithgu

An easier solution in the end was to give the container a class of '.markdown-preview-view, or '.markdown-preview-section, I forget. You still have to give each link .is-unresolved as is appropriate, but you don't need to do any custom styling if the container has that class. This may change the styling of everything else though, so just make sure of that

SkepticMystic avatar Jul 10 '21 05:07 SkepticMystic

have this been resolved?

xfap avatar May 15 '22 09:05 xfap

I believe not. From the looks of it, seems like an annoying Obsidian bug.

AB1908 avatar Jul 01 '22 13:07 AB1908

I don't think this is quite easy to solve. Meanwhile, I've been wanting a boolean attrib for is_resolved inside the link object. Would be a nice QOL thing. Perhaps that could be combined with the rendering to assign the CSS class.

AB1908 avatar Oct 29 '22 21:10 AB1908