-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mark external links #13
Comments
@goerz did you have time to take a look? I think something like the favicon of the other package (if available) would be a great default or a generic external-link-icon. |
I think this is probably out of scope. The way to do this is via CSS. See Stack Overflow for how to: a[href]:not(:where(
/* exclude hash only links */
[href^="#"],
/* exclude javascript only links */
[href^="javascript:" i],
/* exclude relative but not double slash only links */
[href^="/"]:not([href^="//"]),
/* domains to exclude */
[href*="//stackoverflow.com"],
/* subdomains to exclude */
[href*="//meta.stackoverflow.com"],
)):after {
content: '↗️';
} So you just set up something like that in the custom CSS for Documenter. What might make this a little easier is if the HTML generated by What I'm not really up for is literally injecting images or emojis into the link text. That just feels very wrong, and most likely has accessibility issues: screenreaders can separate out the CSS, but actually modifying the content is a different matter. |
maybe css classes with external links and a class name the same as the external package name would be great, yes and sure, pure injection would not be nice, a proper html-class stuff and css is the right way to go for sure. |
Just to emphasize: Even without adding custom classes and all that: CSS already has the capabilities to do everything you want. The "filtering" capabilities of matching |
Will try, maybe a good CSS exercise for a calm evening closer to Christmas :) Will report the result here. |
And you should definitely also do that for your existing Wikipedia links. Like I said, I think |
Sure, I did just not think of the css approach when typing markdown back then. Also my CSS is a bit rusty, last time I worked with that is at least 10 years ago. |
This is the kind of thing where ChatGPT and its cousins excel! 😉 Before I even googled the solution to find the StackOverflow link in #13 (comment):
|
I think the main problem I am struggling with is the relative path to a logo, the rest seems ok. edit: Ah ChatGPT could help again. I will mention you in the PR just in case you want to refer to that in the docs here maybe. |
Very nice! Yes, I think I’ll add that as a tip to the documentation here, at some point. Reopening the issue, to track that… |
Well, thanks for the hints in the right directions :) For now just the switch based on the theme light/dark is not fully complete and I copied over the logos myself. That could maybe be improved. |
Thanks again for this great package. I use it very often, since as soon as one manages e.g. an API package, it is really nice to be able to link back to the API for further details.
While reading the docs I noticed that it might be nice if one can distinguish internal and external links.
Would it maybe be possible to provide a prefix for external links – either within or directly before a link?
Similarly one could also use a postfix of course.
I for example use something like
in my docs whenever I link to wikipedia. One could add a similar option to add an emoji upfront to indicate external links – or even separate emojis for the separate external pages one links to?
The most advanced idea would be to use tven the other (external) packages icons, if for example they have fav-icons specified in their docs.
The text was updated successfully, but these errors were encountered: