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 🙏

© 2024 – Pkg Stats / Ryan Hefner

mdlinks-claudia

v1.1.0

Published

libreria para validar links y obtener estadisticas

Downloads

9

Readme

Mdlinks - Claudia

Índice


1. Resumen

Mdlinks-Claudia es una librería creada a través de Node.js, que lee y analiza archivos en formato Markdown, para verificar los links que contiene y reportar algunas estadísticas, como el total y los links rotos.

2. Flujogramas

2.1 API

![api](C:\laboratoria\MD links\LIM016-md-links\diagramas\diagrama api.png)

2.2 CLI

![cli](C:\laboratoria\MD links\LIM016-md-links\diagramas\diagrama cli.png)

3. Guía de uso

3.1 Instalación

npm i mdlinks-claudia

3.2 Como usar la librería

const md-links = require('mdlinks-claudia');

3.3 Uso en el terminal

Para ejecutarlo en el terminal

$ md-links <path> [options]

Por ejemplo:

$ md-Links ./prueba
href: https://www.google.com.pe/
text: https://www.google.com.pe/
file: C:\laboratoria\MD links\LIM016-md-links\prueba\prueba2.md

El comportamiento por defecto no debe validar si las URLs responden ok o no, solo debe identificar el archivo markdown (a partir de la ruta que recibe como argumento), analizar el archivo Markdown e imprimir los links que vaya encontrando, junto con la ruta del archivo donde aparece y el texto que hay dentro del link (truncado a 50 caracteres).

3.3.1 Options

--validate

Si pasamos la opción --validate, el módulo debe hacer una petición HTTP para averiguar si el link funciona o no. Si el link resulta en una redirección a una URL que responde ok, entonces consideraremos el link como ok.

Por ejemplo:

$ md-Links ./prueba --validate
href: https://es.stackoverflow.com/
text: https://es.stackoverflow.com/
file: C:\laboratoria\MD links\LIM016-md-links\prueba\prueba2.md
status: 200
message: ok
$ md-Links ./prueba --validate
href: https://bitly.com/404-error-page
text: https://bitly.com/404-error-page
file: C:\laboratoria\MD links\LIM016-md-links\prueba\prueba3.md
status: 404
message: fail

Vemos que el output en este caso incluye la palabra ok o fail después de la URL, así como el status de la respuesta recibida a la petición HTTP a dicha URL.

--stats

Si pasamos la opción --stats el output (salida) será un texto con estadísticas básicas sobre los links.

$ md-Links ./prueba --stats
Total: 4
Unique: 4

También podemos combinar --stats y --validate para obtener estadísticas que necesiten de los resultados de la validación.

$ md-links ./prueba --stats --validate
Total: 4
Unique: 4
Broken: 1
--help

Si ingresamos el comando global md-link seguido de la dirección de la ubicación del archivo y seguido del comando --help obtendremos un texto de ayuda como el siguiente:

$ md-links ./prueba --help
********************************************************************************************
                                         HELP
--validate / Show the link, its text, its route, its status number and its status message
--stats    /  Show the total links and the unique links
--stats --validate  / Show the total, unique and broken links
*********************************************************************************************
Use this structure : mdLinks <route> <command> to run the cli
But you can also write only mdLinks <route> and you will get the link, its text and its file

4. Herramientas usadas

5. Autor