https://github.com/tcort/markdown-link-extractor
extracts links from markdown texts
https://github.com/tcort/markdown-link-extractor
extract-links hyperlinks
Last synced: about 1 year ago
JSON representation
extracts links from markdown texts
- Host: GitHub
- URL: https://github.com/tcort/markdown-link-extractor
- Owner: tcort
- License: isc
- Created: 2016-01-11T02:01:37.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2025-03-03T17:38:36.000Z (over 1 year ago)
- Last Synced: 2025-04-06T04:17:34.199Z (about 1 year ago)
- Topics: extract-links, hyperlinks
- Language: JavaScript
- Size: 213 KB
- Stars: 25
- Watchers: 5
- Forks: 20
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# markdown-link-extractor
Extracts links from markdown texts.
## Installation
```bash
$ npm install --save markdown-link-extractor
```
## API
### markdownLinkExtractor(markdown)
Parameters:
* `markdown` text in markdown format.
Returns:
* an array containing the URLs from the links found.
## Examples
```js
const { readFileSync } = require('fs');
const markdownLinkExtractor = require('markdown-link-extractor');
const markdown = readFileSync('README.md', {encoding: 'utf8'});
const links = markdownLinkExtractor(markdown);
links.forEach(link => console.log(link));
```
## Upgrading to v4.0.0
- anchor link extraction no longer supported
Code that looked like this:
```
const { links } = markdownLinkExtractor(str);
```
Should change to this:
```
const links = markdownLinkExtractor(str);
```
## Upgrading to v3.0.0
- extended mode no longer supported
- embedded image size parameters in `![]()` no longer supported
## Testing
npm test
## License
See [LICENSE.md](https://github.com/tcort/markdown-link-extractor/blob/master/LICENSE.md)