Closed th3n00bc0d3r closed 3 years ago
I would really need help in the unit tests....
I've implemented an extended output option.
The second argument is used to enable extended output mode which returns an object rather than just a URL string...
const details = markdownLinkExtractor(markdown, true);
details.forEach(detail => console.log(detail));
The object takes this form:
{ type: 'link',
raw:
'[LICENSE.md](https://github.com/tcort/markdown-link-extractor/blob/master/LICENSE.md)',
href:
'https://github.com/tcort/markdown-link-extractor/blob/master/LICENSE.md',
title: null,
text: 'LICENSE.md',
tokens: [ { type: 'text', raw: 'LICENSE.md', text: 'LICENSE.md' } ] }
Rather than having a single link, it will now return an object which can be traversed for more control over the data.