npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@camilacunha/md-links

v1.0.0

Published

Biblioteca que lê e analisa arquivos no formato Markdown, para verificar os arquivos que contenham links e mostrar algumas estatísticas.

Readme

Markdown Links :link:

forthebadge

Índice

1. Introdução

MD-LINKS é uma biblioteca library de linha de comando (CLI) em JavaScript que usa Node.js, para ler e analisar arquivos no formato Markdown, verificar os arquivos que contenham links e mostrar algumas estatísticas.

Markdown é uma linguagem de marcação muito popular entre os programadores.
É usada em muitas plataformas que manipulam texto (GitHub, fórum, blogs e etc) e é muito comum encontrar arquivos com este formato em qualquer repositório (incluindo este README.md que você está lendo agora :blush:).

2. Instalação :computer:

No terminal, digite o comando abaixo:
$ npm install --global camilagerarde/SAP004-md-links

Se retornar um erro de permissão, tente usar sudo antes do comando, dessa forma:
$ sudo npm install --global camilagerarde/SAP004-md-links

3. Como utilizar :star:

JavaScript API

Para utilizar a biblioteca em um projeto JavaScript, faça o require no arquivo desejado.

Dessa forma:

const mdLinks = require("md-links");

mdLinks("./exemplo.md")
  .then((links) => {
    // => [{ file, href, text }]
  })
  .catch(console.error);

mdLinks("./exemplo.md", { validate: true })
.then((links) => {
    // => [{ file, href, text, validate }]
  })
  .catch(console.error);

CLI (Command Line Interface - Interface de Linha de Comando)

Utilize o executável da seguinte maneira, através do terminal:

$ md-links <path-to-file-or-directory> [options]

  • path: Rota absoluta ou relativa para o arquivo, ou diretório.
  • options: Um objeto com a seguinte propriedade:
    • validate: Um booleano que determina se deseja validar os links encontrados.
    • stats: Um booleano que determina se deseja verificar estatísticas dos links.

Valor de retorno

O retorno será um array de objetos, onde cada objeto representa um link, com as seguintes propriedades:

  • file: Rota do arquivo onde foi encontrado o link.
  • url: URL encontrada.
  • text: Texto descritivo do link.

O comportamento padrão identifica o arquivo Markdown (a partir da rota que recebeu como argumento), analisa e retorna os links encontrados, junto com a rota do arquivo e o texto descritivo.

Por exemplo:

$ md-links ./test

File: ./test/example.md
URL: https://pt.wikipedia.org/wiki/Markdown
Text: Markdown

File: ./test/example.md
URL: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refere
Text: JavaScript

Options

--validate ou -v

Se incluir a opção --validate, o módulo faz uma requisição HTTP para verificar se o link está ativo.

$ md-links ./example.md --validate

File: ./example.md
URL: https://pt.wikipedia.org/wiki/Markdown
Text: Markdown
Validate: 200 OK

File: ./example.md
URL: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refere
Text: JavaScript
Validate: 404 Not Found
--stats ou -s

Se incluir a opção --stats o output (saída) será um texto com estatísticas (total e únicos) sobre os links.

$ md-links ./test --stats

Total links: 5
Unique links: 4
--validate --stats ou -v -s

Se combinadas as opções --stats e --validate o output será um texto com estatísticas sobre os links, incluindo links "quebrados".

$ md-links ./test --validate --stats

Total links: 5
Unique links: 4
Broken links: 1

4. Desinstalação :warning:

Para desinstalar a biblioteca, utilize o comando:

$ npm uninstall --global md-links

ou em casos de erro de permissão:
$ sudo npm uninstall --global md-links

Caso persista o erro utilize o comando, para verificar o nome da pasta onde foi instalada a biblioteca.
$ npm list --global --depth=0

e utilize:
$ npm uninstall --global <nome-da-pasta>

5. Considerações gerais

Tecnologias e bibliotecas utilizadas

Autoria

Feito por Camila Cunha, para o Bootcamp da Laboratória.

forthebadge