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

how do you enforce .find to require a protocol for strings that aren't emails? #491

Open
fridaystreet opened this issue Oct 5, 2024 · 0 comments

Comments

@fridaystreet
Copy link

I've just noticed in our editor that uses linkify to find links in typed or pasted text, that the library by default is returning that a string with a dot (and no protocol) in it is a valid url if the chars after the text are a valid tld.

Is there an option to disable this? I noticed in another library linkify-it, it has an option to disable fuzzyUrl matching which measn no protocol strings.

try the basic example below

const simpleStr = 'node.id'
const { find } = require('linkifyjs')
console.log(find(simpleStr))

\\returns
[
  {
    type: 'url',
    value: 'node.id',
    isLink: true,
    href: 'http://node.id',
    start: 0,
    end: 7
  }
]

Any assitance would be greatly appreciated. Thanks

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

No branches or pull requests

1 participant