-
Notifications
You must be signed in to change notification settings - Fork 17
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
Add hyperlink style support #19
Comments
I'm generally in favor, but there's a backwards compatibility issue. From the gist:
Here's the problem: imagine a builder method that lets you set a link on a println!("Visit our {}", Paint::new("docs").link("https://api.rocket.rs")); On terminals that support links, they'll see:
But terminals that don't support links will see:
That is, the link is completely lost. You want to display the actual link and likely different text if the hyperlink won't be rendered:
What's the API for this? The following seems unfortunate: println!("Visit our {}", Paint::new("docs").link_or("https://api.rocket.rs", "docs at https://api.rocket.rs")); Maybe we can default to showing the link in parenthesis when
There is also this:
So, to be safe, we'd need to conservatively detect whether the terminal supports hyperlinks. This project seems to do it, but it's not clear to me how correct or reliable it is. We should have no false positives; false negatives are okay. We should have a |
|
If we support something conditionally, we should support detecting it. It doesn't make sense to say "Hey, you can enable or disable hyperlink support, but you gotta figure out if the thing you're talking to actually supports it!" This is totally error prone and really unfriendly. Edit: come to think of it, I suppose |
Alright, I think if we disable displaying hyperlinks by default and have a toggle for enabling them, my concerns are resolved. This is the inverse of what we do for coloring, which makes sense given the differences I've alluded to above. |
That isn't true for true color but |
The |
See https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
The text was updated successfully, but these errors were encountered: