3.1.0 • Published 4 years ago
autoantwort-markdown-link-extractor v3.1.0
markdown-link-extractor
Extracts links from markdown texts.
Installation
$ npm install --save markdown-link-extractorAPI
markdownLinkExtractor(markdown)
Parameters:
markdowntext in markdown format.
Returns:
- an object with the following properties:
.anchors: an array of anchor tag strings (e.g.[ "#foo", "#bar" ])..links: an array containing the URLs from the links found.
Examples
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 v3.0.0
- extended mode no longer supported
- embedded image size parameters in
![]()no longer supported
Upgrading to v2.0.0
The return value changed from an array to an object. The old return value is
found at the property links.
Code that looked like this:
const links = markdownLinkExtractor(str);Should change to this:
const { links } = markdownLinkExtractor(str);Testing
npm testLicense
See LICENSE.md
3.1.0
4 years ago