bennyxguo / Obsidian-Obsidianite

🎨 Obsidian.md custom theme, it's dark and simple but yet still stays sparkles!
MIT License
279 stars 48 forks source link

Text editor link highlights are the same color for existant and non-existant links #30

Open tekwizz123 opened 3 years ago

tekwizz123 commented 3 years ago

Title pretty much says it all. In the preview pane, the color for existent and non-existent links are different, as non-existent links show up in a faded grey, whilst existing links have a blue underline if an internal link, or purple underline if external. Yet in editor mode, the same link shows with a blue underline regardless of if the linked note exists or not.

bennyxguo commented 3 years ago

Ok, I will work on it this week. :)

krokofant commented 1 year ago

It seems that Obsidian itself does not differentiate between existing and non-existing links in editing mode. So the editing mode can't be fixed here. image

image

Unfortunately this problem also exists for the live preview mode, and it's actually a little worse there. image

bennyxguo commented 1 year ago

@krokofant I got this one fixed by applying the underline style to the cm-underline class inside the cm-link. Thanks for keeping me updated on these issues and doing the contributions! 👍🏻

krokofant commented 1 year ago

@bennyxguo That's great! You fixed the live preview issue (which was reported separately), but this issue I assume still exists. That existing and non-existing link references all look the same in edit mode & live preview mode. As far as I can tell Obsidian only exposes classes for targeting existing links in read mode (.internal-link.is-unresolved).

Edit mode: image

<div class="cm-line"><img class="cm-widgetBuffer" aria-hidden="true"><span contenteditable="false"></span><img class="cm-widgetBuffer" aria-hidden="true"><span class="cm-link"><span class="cm-underline">This exists</span></span><img class="cm-widgetBuffer" aria-hidden="true"><span contenteditable="false"></span><img class="cm-widgetBuffer" aria-hidden="true"><img class="cm-widgetBuffer" aria-hidden="true"><span contenteditable="false"></span><img class="cm-widgetBuffer" aria-hidden="true"><img class="cm-widgetBuffer" aria-hidden="true"><span contenteditable="false"></span><img class="cm-widgetBuffer" aria-hidden="true"><img class="cm-widgetBuffer" aria-hidden="true"><span contenteditable="false"></span><img class="cm-widgetBuffer" aria-hidden="true"></div>
<div class="cm-line"><img class="cm-widgetBuffer" aria-hidden="true"><span contenteditable="false"></span><img class="cm-widgetBuffer" aria-hidden="true"><span class="cm-link"><span class="cm-underline">This doesn't exist</span></span><img class="cm-widgetBuffer" aria-hidden="true"><span contenteditable="false"></span><img class="cm-widgetBuffer" aria-hidden="true"><img class="cm-widgetBuffer" aria-hidden="true"><span contenteditable="false"></span><img class="cm-widgetBuffer" aria-hidden="true"><img class="cm-widgetBuffer" aria-hidden="true"><span contenteditable="false"></span><img class="cm-widgetBuffer" aria-hidden="true"><img class="cm-widgetBuffer" aria-hidden="true"><span contenteditable="false"></span><img class="cm-widgetBuffer" aria-hidden="true"></div>

Read mode: image

<a class="internal-link" data-href="Test document" href="Test document" target="_blank" rel="noopener">This exists</a>
<br>
<a class="internal-link is-unresolved" data-href="Test2" href="Test2" target="_blank" rel="noopener">This doesn't exist</a>

I tried doing a quick search on the forum about this but didn't find anything.

Edit: Mentioned in the forum

bennyxguo commented 1 year ago

Thanks for the detail report, let me try it out.