-
-
Notifications
You must be signed in to change notification settings - Fork 12
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 support for disabling the fallback #5
Add support for disabling the fallback #5
Conversation
index.js
Outdated
@@ -4,8 +4,14 @@ import PropTypes from 'prop-types'; | |||
import terminalLink from 'terminal-link'; | |||
|
|||
const Link = props => { | |||
const options = { | |||
fallback: (text, url) => { | |||
return props.fallback ? `${text} (\u200B${url}\u200B)` : text; |
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.
Happy to open a PR to terminal-link
to export the default fallback function, if we want to avoid duplicating it here.
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.
I would make terminal-link
support {fallback: false} to disable the fallback. Then we don’t need to export it. What do you think?
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.
Down for that, too! Can open a PR in a sec.
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.
@colinking Friendly bump :)
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.
Thanks for the bump @sindresorhus! Opened a PR here: sindresorhus/terminal-link#13
I'll update this PR when a new version of terminal-link
is released :)
98c86ba
to
7f17b98
Compare
@@ -14,4 +20,4 @@ Generated by [AVA](https://ava.li). | |||
|
|||
> Snapshot 1 | |||
|
|||
'My Website (https://sindresorhus.com)' | |||
'My Website (https://sindresorhus.com)' |
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.
adds zero-width spaces, after bumping to terminal-link@2.0.0
Great, thanks for making the release! I updated this PR, but realized we should update |
This PR resolves #4 by adding a boolean
fallback
parameter (which defaults totrue
, so backwards compatible) which allows consumers to disable the fallback link.