UNPKG

markdown-links-check

Version:

This lib extract the links in a markdown file, has two options: an array result with all links in the file with the title and the URL or test all the URLs and return the status code for each one.

19 lines (14 loc) 470 B
#!/usr/bin/env node import readFile from "./index.js"; import chalk from "chalk"; import validateURLS from "./http-validation.js"; const path = process.argv; async function processText(path) { const result = await readFile(path[2]); if (path[3] === "validate") { console.log(chalk.yellow('Validated links:'), await validateURLS(result)); } else { console.log(chalk.yellow('Links: '), result); } } processText(path);