keupa-mdlinks
v1.0.2
Published
fetch and validate links from a markdown file
Downloads
5
Readme
keupa-mdlinks is a library for node.js that allows the user to extract links from a markdown file (.md) and verify the status ( 200 or 404 ).
Install
$ npm i keupa-mdlinks
CLI Usage
$ keupa-mdlinks --file <path-to-file>
Options
--validate // --v
The module makes an http request, validates the link, and returns the HTTP status. Example:
$ keupa-mdlinks --validate --file <path-to-file>
Validated links from your ./test/links.md file:
⋆ href: https://www.google.com/idhucda status: 404 FAILED✕
⋆ href: http://superbad.com/1/turkey/viv.html status: 200 OK✓
⋆ href: http://lewisatkins.com/projects status: 200 OK✓
--stats // --s
The module returns the links basic stats. Example:
$ keupa-mdlinks --stats --file <path-to-file>
Your file ./test/links.md contains:
⋆ Total: 3
⋆ Unique: 3
--stats --validate // --s --v
The module makes an HTTP requests and returns validated stats. Example:
$ keupa-mdlinks --stats --validate --file <path-to-file>
Your file ./test/links.md contains:
⋆ Total: 3
⋆ Unique: 3
Objetivos de aprendizaje
Recuerda colocar en esta seccion los objetivos de aprendizaje que quedaron pendientes de tu proyecto anterior.
Javascript
- [ ] Uso de callbacks
- [ ] Consumo de Promesas
- [ ] Creacion de Promesas
- [ ] Modulos de Js
- [ ] Recursión
Node
- [ ] Sistema de archivos
- [ ] package.json
- [ ] crear modules
- [ ] Instalar y usar modules
- [ ] npm scripts
- [ ] CLI (Command Line Interface - Interfaz de Línea de Comando)
Testing
- [ ] Testeo de tus funciones
- [ ] Testeo asíncrono
- [ ] Uso de librerias de Mock
- [ ] Mocks manuales
- [ ] Testeo para multiples Sistemas Operativos
Git y Github
- [ ] Organización en Github
Buenas prácticas de desarrollo
- [ ] Modularización
- [ ] Nomenclatura / Semántica
- [ ] Linting
Pistas / Tips
FAQs
¿Cómo hago para que mi módulo sea instalable desde GitHub?
Para que el módulo sea instalable desde GitHub solo tiene que:
- Estar en un repo público de GitHub
- Contener un
package.json
válido
Con el comando npm install githubname/reponame
podemos instalar directamente
desde GitHub. Ver docs oficiales de npm install
acá.
Por ejemplo, el course-parser
que usamos para la currícula no está publicado en el registro público de NPM,
así que lo instalamos directamente desde GitHub con el comando npm install
Laboratoria/course-parser
.
Sugerencias de implementación
La implementación de este proyecto tiene varias partes: leer del sistema de archivos, recibir argumentos a través de la línea de comando, analizar texto, hacer consultas HTTP, ... y todas estas cosas pueden enfocarse de muchas formas, tanto usando librerías como implementando en VanillaJS.
Por poner un ejemplo, el parseado (análisis) del markdown para extraer los links podría plantearse de las siguientes maneras (todas válidas):
- Usando un módulo como markdown-it, que nos devuelve un arreglo de tokens que podemos recorrer para identificar los links.
- Siguiendo otro camino completamente, podríamos usar
expresiones regulares (
RegExp
). - También podríamos usar una combinación de varios módulos (podría ser válido transformar el markdown a HTML usando algo como marked y de ahí extraer los link con una librería de DOM como JSDOM o Cheerio entre otras).
- Usando un custom renderer de marked
(
new marked.Renderer()
).
No dudes en consultar a tus compañeras, coaches y/o el foro de la comunidad si tienes dudas existenciales con respecto a estas decisiones. No existe una "única" manera correcta :wink:
Tutoriales / NodeSchool workshoppers
Otros recursos
- Acerca de Node.js - Documentación oficial
- Node.js file system - Documentación oficial
- Node.js http.get - Documentación oficial
- Node.js - Wikipedia
- What exactly is Node.js? - freeCodeCamp
- ¿Qué es Node.js y para qué sirve? - drauta.com
- ¿Qué es Nodejs? Javascript en el Servidor - Fazt en YouTube
- ¿Simplemente qué es Node.js? - IBM Developer Works, 2011
- Node.js y npm
- Módulos, librerías, paquetes, frameworks... ¿cuál es la diferencia?
- NPM
- Publicar packpage
- Crear módulos en Node.js
- Leer un archivo
- Leer un directorio
- Path
- Linea de comando CLI
- Promise
- Comprendiendo Promesas en Js
- Pill de recursión - video
- Pill de recursión - repositorio