hyperlinkify
hyperlink urls in text
Install
npm install hyperlinkify
Usage
basic example
const hyperlinkify = const text = 'visit http://example.com for more info' console// visit <a href="http://example.com">http://example.com</a> for more info
example with attributes
const text = 'visit http://example.com for more info' console// visit <a href="http://example.com" target="_blank" data-foo="bar">http://example.com</a> for more info
example with conditional attributes
const text = 'hello http://example.com world http://localhost:8000' const result = console// hello <a href="http://example.com" target="_blank">http://example.com</a> world <a href="http://localhost:8000">http://localhost:8000</a>
Test
npm test
License
MIT