0.1.0 • Published 7 years ago

get-md-links v0.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

get-md-links Build Status

Get links from markdown article

Install

npm install --save get-md-links

Usage

import getLinks from 'get-md-links'

const article = `# title

this is [foo](https://foo.bar)`

getLinks(article).length  // 1
getLinks(article)[0].text // foo
getLinks(article)[0].href // https://foo.bar
getLinks(article)[0].html // <a href="https://foo.bar">foo</a>
getLinks(article)[0].node // AST node, see commonmark API
getLinks('')              // []

API

getLinks(input, exclude)

input

Type: string

Markdown string.

exclude(node)

Type: function

Filter function receiveing a node as argument.

Related

License

MIT