Skip to content
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

Merged
merged 5 commits into from
Dec 19, 2019

Conversation

colinking
Copy link
Contributor

This PR resolves #4 by adding a boolean fallback parameter (which defaults to true, so backwards compatible) which allows consumers to disable the fallback link.

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;
Copy link
Contributor Author

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.

Copy link
Owner

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?

Copy link
Contributor Author

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.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@colinking Friendly bump :)

Copy link
Contributor Author

@colinking colinking Dec 17, 2019

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 :)

package.json Outdated Show resolved Hide resolved
@@ -14,4 +20,4 @@ Generated by [AVA](https://ava.li).

> Snapshot 1

'My Website (https://sindresorhus.com)'
'My Website (https://sindresorhus.com)'
Copy link
Contributor Author

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

index.js Show resolved Hide resolved
@colinking colinking marked this pull request as ready for review September 21, 2019 23:29
@sindresorhus sindresorhus changed the title Add support for disabling fallback Add support for disabling the fallback Dec 1, 2019
@sindresorhus
Copy link
Owner

@colinking
Copy link
Contributor Author

Great, thanks for making the release! I updated this PR, but realized we should update terminal-link to accept fallback=true.

See: sindresorhus/terminal-link#14

@sindresorhus
Copy link
Owner

https://github.com/sindresorhus/terminal-link/releases/tag/v2.1.1

@sindresorhus sindresorhus merged commit bc2fdaa into sindresorhus:master Dec 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: option to disable fallback
2 participants