An open API service indexing awesome lists of open source software.

https://github.com/uiur/link-text

Autolink text
https://github.com/uiur/link-text

Last synced: 3 months ago
JSON representation

Autolink text

Awesome Lists containing this project

README

        

# link-text

[![npm][npm-image]][npm-url]
[![travis][travis-image]][travis-url]

[npm-image]: https://img.shields.io/npm/v/link-text.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/link-text
[travis-image]: https://img.shields.io/travis/uiureo/link-text.svg?style=flat-square
[travis-url]: https://travis-ci.org/uiureo/link-text

A function to autolink text. It turns text into linked text with anchor tags.

```js
var link = require('link-text')

link('foo https://google.com bar')
//=> 'foo https://google.com bar'

link('aaa ')
//=> 'aaa <script>'

link('https://google.com', { target: '_blank' })
//=> '<a href="https://google.com" target="_blank">https://google.com</a>'

link('https://ja.wikipedia.org/wiki/%E5%AF%BF%E5%8F%B8')
//=> '<a href="https://ja.wikipedia.org/wiki/%E5%AF%BF%E5%8F%B8">https://ja.wikipedia.org/wiki/寿司</a>'
```

## Install

```
npm install link-text
```

## License

[ISC](LICENSE)