jonahgoldwastaken/mdbook-external-links

Allow styling external links

phijor opened this issue · 2 comments

phijor commented

I'm writing a book and I want to visually and functionally distinguish external from internal links. Your plugin helps me achieve the functionality. Now I also want to style external links. I reckon this could be trivially supported by...

  1. Adding a class="external-link" to <a> tags in addition to target="_blank"
  2. Letting the user write some custom CSS, such as
    a.external-link::after {
      font-family: FontAwesome;
      content: "\f08e"; /* fa-external-link */
      display: inline-block;
      padding-left: 3px;
      vertical-align: middle;
    }

Do you think this is a sensible addition to the plugin?

Hey there, I think this is a sensible addition to the plugin. Before I go ahead with adding it though, I want to ask of you to try to use the attribute selector a[target="_blank"] and see if that doesn't cause any complications.

phijor commented

Hah! I checked, and it turns out that matching a[target="_blank"] works fine in my case. That's of course a much cleaner solution, thank you very much for the suggestion. I'll go ahead and close the issue :)