Browse Source

Format markdown better

pull/1/merge
Luke Childs 9 years ago
parent
commit
7ada64cfa6
  1. 13
      README.md

13
README.md

@ -1,7 +1,9 @@
# my-name-is-url [![Build Status](https://travis-ci.org/lukechilds/my-name-is-url.svg?branch=master)](https://travis-ci.org/lukechilds/my-name-is-url) [![Coverage Status](https://coveralls.io/repos/github/lukechilds/my-name-is-url/badge.svg?branch=master)](https://coveralls.io/github/lukechilds/my-name-is-url?branch=master) # my-name-is-url [![Build Status](https://travis-ci.org/lukechilds/my-name-is-url.svg?branch=master)](https://travis-ci.org/lukechilds/my-name-is-url) [![Coverage Status](https://coveralls.io/repos/github/lukechilds/my-name-is-url/badge.svg?branch=master)](https://coveralls.io/github/lukechilds/my-name-is-url?branch=master)
Intelligently finds many different url formats in a string. For the browser and node. Intelligently finds many different url formats in a string. For the browser and node.
## About ## About
In a nutshell, `my-name-is-url` is an intelligent parser that searches a string of text for urls. The url spec is so vague that almost anything _could_ be a url. The regular expression used in `my-name-is-url` tries to match patterns likely to represent a url in a sentence rather than matching the actual url spec. In a nutshell, `my-name-is-url` is an intelligent parser that searches a string of text for urls. The url spec is so vague that almost anything _could_ be a url. The regular expression used in `my-name-is-url` tries to match patterns likely to represent a url in a sentence rather than matching the actual url spec.
> ❗️**Important note** > ❗️**Important note**
@ -9,34 +11,43 @@ In a nutshell, `my-name-is-url` is an intelligent parser that searches a string
> If you're trying to parse a url into sections (scheme,host) or check a url is valid this module isn't for you. This module is intended to find urls in a string. > If you're trying to parse a url into sections (scheme,host) or check a url is valid this module isn't for you. This module is intended to find urls in a string.
## Install ## Install
```shell ```shell
$ npm install --save my-name-is-url $ npm install --save my-name-is-url
``` ```
or or
```shell ```shell
$ jspm install npm:my-name-is-url $ jspm install npm:my-name-is-url
``` ```
## Usage ## Usage
Import the module Import the module
#### CommonJS #### CommonJS
```js ```js
var Urls = require('my-name-is-url'); var Urls = require('my-name-is-url');
``` ```
#### ES6 #### ES6
```js ```js
import Urls from 'my-name-is-url'; import Urls from 'my-name-is-url';
``` ```
### Regex ### Regex
If you just wanna do your own thing the regex used internally is helpfully exposed If you just wanna do your own thing the regex used internally is helpfully exposed
```js ```js
const UrlRegex = Urls.regex; const UrlRegex = Urls.regex;
``` ```
### Get Urls ### Get Urls
The `get()` method returns an array of urls in a string The `get()` method returns an array of urls in a string
```js ```js
@ -48,6 +59,7 @@ Urls(text).get(); // Returns:
``` ```
### Filter Urls ### Filter Urls
The `filter()` method runs a filter on each url in a string The `filter()` method runs a filter on each url in a string
```js ```js
@ -63,4 +75,5 @@ Urls(text).filter(url => `<a href="${url}">${url}</a>`); // Returns:
> You can get a parser instance by calling `Urls()` or `new Urls`, whichever you prefer. > You can get a parser instance by calling `Urls()` or `new Urls`, whichever you prefer.
## License ## License
MIT © Luke Childs MIT © Luke Childs

Loading…
Cancel
Save