Can't get PDF Markdown Hyperlinks to be Set to Color Red

Things I have tried

I’ve tried creating a CSS snippet:

@media print {

  a:link, a:visited, a {
    color: red;
  }

This works only when I use <a href="https://example">link</a>. However, it does not change my hyperlinks using Obsidians markdown language: [link](https://google.com).

What I’m trying to do

How can I change the color of [link](https://example.com) markdown hyperlinks within a CSS snippet?

Also to be noted, I am using the following Obsidian theme (not sure if this matters or not): GitHub - bennyxguo/Obsidian-Obsidianite: 🎨 Obsidian.md custom theme, it's dark and simple but yet still stays sparkles!

Try “a.link:visited” - does that work?

Hi thank you for trying to help. Unfortunately this doesn’t work. I suppose I don’t really care about the visited segment but rather the general color:

@media print {
  a:link {
    color: red;
  }
}

Just wish for the hyperlinks to be red:

Screen Shot 2022-11-11 at 17.28.43

I have so many hyperlinks throughout the document that it would be painful to change all []() hyperlinks to that of <a href=""></a>. Just wondering if there is a way to make a CSS snippet for the []() markdown links as opposed to the <a href=""></a> syntax?

in any case it has to be a.link and not a:link.

I don’t have the time right now to try it out, unfortunately.

HI, thank again, but even with a.link it doesn’t work. This appears to be associated with a href, and not that of markdown links. Do you know what CSS is required here for markdown links as opposed to a?

This works in local tests:

.print .external-link {
color: red;
}
1 Like

I don’t know what Obsidian’s particular markup needs, but in general a:link is a proper thing. I forget what it’s called, but it’s not a class, which is what a.link indicates.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.