https://github.com/marciapsilva/link-sniffer
Biblioteca de javascript que extrai todos os links encontrados em uma string com formato markdown. Produto final do Sprint 4 da Laboratória.
https://github.com/marciapsilva/link-sniffer
automated-testing automation-test ecmascript2015 ecmascript6 es6 eslint javascript library npm nyc test-automation
Last synced: 4 months ago
JSON representation
Biblioteca de javascript que extrai todos os links encontrados em uma string com formato markdown. Produto final do Sprint 4 da Laboratória.
- Host: GitHub
- URL: https://github.com/marciapsilva/link-sniffer
- Owner: marciapsilva
- Created: 2018-09-01T17:25:18.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-09-05T22:58:53.000Z (almost 8 years ago)
- Last Synced: 2025-10-21T02:15:28.120Z (8 months ago)
- Topics: automated-testing, automation-test, ecmascript2015, ecmascript6, es6, eslint, javascript, library, npm, nyc, test-automation
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/link-sniffer
- Size: 34.2 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Link Sniffer v2.0.0
**This library function is to extract all links within a string written in _markdown_ format.**
It returns an array of objects containing each URL and the text that received the URL.
## Installation
After installing npm in the computer (more info about that [here](https://www.npmjs.com/get-npm)), enter the following code in the Terminal:
```
$npm install link-sniffer
```
## Usage example
In Node.js, enter:
```
const lib = require('link-sniffer');
const str = `# Lorem ipsum
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut [labore](https://en.wiktionary.org/wiki/labore) et [dolore](https://en.wiktionary.org/wiki/dolore) magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
[foo](http://foo.com)
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.`;
lib.getLinksFromMd(str);
//[
// { href: 'https://en.wiktionary.org/wiki/labore', text: 'labore' },
// { href: 'https://en.wiktionary.org/wiki/dolore', text: 'dolore' },
// { href: 'http://foo.com', text: 'foo' },
//]
```
## Roadmap
#### Version 3.0.0 (tba)
- It ignores a repeated URL already pushed into the result's array, as long as linked to the same word.
#### Version 2.0.0 (published)
- Errors's messages and README translated into English.
#### Version 1.0.0 (published)
- It returns an array of objects containing each URL and the text that received the URL.
## Project on Github
[Link Sniffer](https://github.com/marciapsilva/link-sniffer)