Styling for internal link without file (After 0.9.4 in edit mode)

It would be helpful to support CSS styling for internal links that don’t have a file. Could simply be a HTML class like internal-link-no-file. Right now, I have to do hover preview to see whether there is a file behind a link.

23 Likes

I hope to distinguish them in the graph view too.

6 Likes

+1 for this. Also, if I may add to this request, a way to list all such links perhaps in the search pane with some token might also be very useful.

6 Likes

When faced with a significant number of notes with a lot of backlinks, it would help if the links that are not leading to any files were differentiated in some way that would make them visually detectable at first glance.


So for example: in the current version, I have three tags in a note:
[[art]] ->(rendered this way)-> art
[[questions]] ->(rendered this way)->questions
[[answers]] ->(rendered this way) -> answers
now even though all three are rendered the same way, there is no file named “questions”.
It would be great if it was italicized and or highlighted or was rendered in a different color.


so it would look line this:
[[art]] ->(rendered this way)-> art
[[questions]] ->(rendered this way)->questions
[[answers]] ->(rendered this way) -> answers


It would help in a couple of different ways:

  1. Tell you which links have been misspelled.
  2. Tell you which files are needed to be made in order to complete a network of data.
9 Likes

You would have to define it with CSS but if this (link below) goes forward it would solve that problem.
https://forum.obsidian.md/t/css-support-for-missing-pages/3002/2?u=meins

5 Likes

Would be good if suchlinks appear in red, like how they show it in Wikipedia

2 Likes

Over in CSS support for "missing pages", we talked about making classes for these sorts of links, but not automatically styling them in the default Obsidan stylesheets, so that users can use their own obsidian.css file to determine which of these special links should be highlighted in CSS and in what way.

Personally, I’d probably put a font-awesome icon at the end of them instead of changing the actual font color, but that’s the kind of personal preference this would allow us to have.

3 Likes

Wow! that’s a nice idea! How can one add font-awesome icon there?

I believe that you’d add a content attribute to the class you want to target, but now that I think about it, you’d probably need to append a class for FontAwesome to the element, which I don’t think we can do without a pretty extensive Obsidian API that doesn’t exist yet. So maybe FA is out for a while.

On the other hand, if we have a class assigned to missing links, we could target missing::after in CSS and add content: "⚠" (or whatever emoji of your choice) and use that instead to delineate missing links.

After actually looking at the setup in Obsidian, it seems that instead of ::after the devs append the external link icon using a SVG background and some extra left padding, so not the same thing. Not sure if it’d be possible to piggyback that or just use the same design pattern for our icon-after-missing-link trick.

1 Like

+1 — I think this would be super helpful

Also this topic should be merged with the following topics:


https://forum.obsidian.md/t/visually-different-display-of-broken-links/238/9

When I’m brainstorming a lot of content, I really like to be able to enter [[some new link]] while in the middle of a thought without stopping to create the new page. It’d be really convenient if I could style links to non-existing pages to be different, like they appear in MediaWiki and DokuWiki. That would allow me to quickly see what I need to write up or explore at a glance, rather than needing to mouse over each one to see if it exists.

I looked into the CSS, and it doesn’t seem like there’s an equivalent to the CSS class “new” in MediaWiki, so I can’t write custom CSS to select and style it. And yet, it shouldn’t be terribly hard, because Obsidian already knows when links are pointed an existing or a non-existent page.

I don’t think the default stylesheets need to actually style missing links themselves, but having the option to do so in my override CSS would be great.

8 Likes

There used to be such a class actually (missing links were styled red like in MediaWiki), but it was removed. We can add it back without styling it, yeah.

19 Likes

That seems like an excellent middle ground. Thanks!

2 Likes

@silver would it also be feasible to apply this to the graph as well? I don’t know if it’s possible to style the graph nodes with CSS, but that would be an awesome value add for this feature request.

1 Like

I’d love this specifically for styling my Calendar View (credit @Jeffurry) so I can see which days I have notes for and which I don’t.

2 Likes

@liam How did you get that calendar view?

@Mat deserves the credit - I’m just a blagger!

1 Like

It’s just a Markdown table with [[inline links]]. These are the 2 markdown files posted in the discord :point_down:

Calendars.zip (4.8 KB)

So if you add them to your Vault, It Just Works :tm:

5 Likes

Could we get “broken” links (and also, perhaps, links to not yet created notes) displayed with some visual marker … maybe different colours, or squiggly underline or something?

20 Likes

This could be really handy!