-
Notifications
You must be signed in to change notification settings - Fork 94
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
Adding a font-awesome icon for external links #767
base: master
Are you sure you want to change the base?
Conversation
6aa6016
to
bcf88ba
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice !
For those people, the filter won't work, so instead of the currentColor external link icon, they will have a currentColor filled square
That's fine to me. We also use CSS-variables and media queries which have a similar compatiblity: https://caniuse.com/css-variables
The fallback to a filled square is really nothing compared to the mess that would result from not having the other features we use.
Could this be rebased @panglesd ? |
I don't think a mutual agreement was reached in #669, so I would be in favor of letting this PR rot. The feature is of pretty low priority/interest (but it was a good exercise to enter in this codebase!). |
Let's tidy the open PRs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This contains two changes to the html generator:
- Add the
external-link
class to external links ("external" in the sense of a link to a page not generated by Odoc). - Change the default CSS to show an icon on
.external-link
s.
I think the first change should be merged so that documentation integrator can style these links differently if needed. There seem to be several people interested in this: #669
That seems a fair compromise. I'll reopen the PR, rebase and remove the added css. |
828886b
to
bca99b5
Compare
Signed-off-by: Paul-Elliot <[email protected]>
I removed the added icon but kept the class on external links, and rebased. Feel free to merge (or close) this PR! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A rebase is needed and the tests should be promoted on < 4.10.
This is harmless and improves customizability. Let's merge!
This is a PR to address Issue #669.
It adds an icon after external links. The icon is taken from here: https://fontawesome.com/v6.0/icons/up-right-from-square (it's the only "external link" icon that is not a Pro icon):
I tried to follow both suggestions: making the svg inline in the css, and using
currentColor
. However, this is not that easy: one cannot manipulate the color of an svg pseudo-element that easily.I came up with the following
ugly hacksolution: the svg is a mask, and the background color iscurrentColor
.This comes with a price: with both its prefix and unprefixed version, caniuse report that only 95.41% of users have a browser that supports this functionnality. To distinguish between desktop and mobile, its respectively 96.52% and 95.16%.
Here are some details:
For those people, the filter won't work, so instead of the
currentColor
external link icon, they will have acurrentColor
filled square...How acceptable do you think that is? If that's not acceptable, there are to options:
currentColor
. We can use the widely supported (99.95% for desktop)content
property. The icon will always be black.currentColor
.