Code Monkey home page Code Monkey logo

lib-markdown-nodejs's Introduction

My first NodeJS Library - Lib Markdown

This lib was created throughout one of Alura's courses of NodeJS.

It is very simple and made for study purposes, but feel free to try it out!

See it also on npm!

What does it do?

It reads a markdown file and searches for hyperlinks in it, using regular expressions (regex) to do the trick.

For instance, if you have in your markdown file a hyperlink pointing to https://german-gender-api.deta.dev, it will show you the following response in your terminal:

npm run cli ./arquivos/texto1.md

   Lista de links:
   [ { 'German Gender API': 'https://german-gender-api.deta.dev/' } ]

It includes a title, "Lista de links" (List of links) and an array of each hyperlink and its title inside the markdown file.

How do I run it?

It's simple: simply type 'npm run cli' in your terminal, and pass the following arguments:

  1. File path, e.g., ./arquivos/texto1.md
  2. validar (optional)

As to the second argument, if you want to, you can also validate each link of the read file by adding it.

If you do so, it'll show you the hyperlinks in the file, as well as the status code of requests made on them.

npm run cli ./arquivos/texto1.md

   Links validados: 
   [
     {
       'German Gender API': 'https://german-gender-api.deta.dev/',
       status: '200 - OK'
     }
   ]   

Project Dependencies and Structure

  • node-fetch (to make the requests)
  • chalk (to color the terminal output)
├── cli.js
├── examples
│   ├── index.js
│   └── percorrendo-diretorios.js
├── http-validacao.js
├── index.js
├── package.json
├── package-lock.json
├── README.md
└── test
    └── index.test.js

What about this 'examples' folder?

It contains some tests related to my studies of JavaScript and NodeJS. Since this is not a serious library, I'll keep them there ^~^.

lib-markdown-nodejs's People

Contributors

andrew-2609 avatar

Stargazers

Nicholas_Miyasato avatar  avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.