Security News
cURL Project and Go Security Teams Reject CVSS as Broken
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
@raulingg/md-links
Advanced tools
This repository is an implementation of this proposal
Find all links included in a markdown file or in all markdown files inside a folder.
to install globally
npm install -g @raulingg/md-links
to install as a dependency in your project
npm install @raulingg/md-links
Requiring dependency
const mdLinks = require('@raulingg/md-links')
mdLinks('path/to/file.md')
.then(mdlink => {
// Return an object with two methods data and stats
// data() return an array with results
mdlink.data().forEach(item => {
console.log(item.path, item.href, item.text)
})
});
// find links in all markdown files inside a directory
mdLinks('path/to/directory').data().then(data => {});
Importing using ES6
import mdLinks from require('@raulingg/md-links')
const mdlink = await mdLinks('path/to/file.md')
const results = mdlink.data()
// do whatever you want
validate broken links
mdLinks('path/to/file.md', { validate: true}).then((mdlink) => {
mdlink.data().forEach((item) => {
console.log(item.path, item.text, item.href, item.status, item.statusCode)
})
});
Get stats
/**
* Stats Object
* {
* total: <#linksFound>
* unique: <#LinksUnique>
* broken: <#LinksBroken>
* }
*/
mdLinks('path/to/file.md').then(mdlink => mdlink.stats());
// get stats from broken links
mdLinks('path/to/file.md', { validate: true}).then(mdlink => mdlink.stats());
Basic usage
# single file
md-links <path/to/file.md>
# scan all markdown files in directory
md-links <path/to/directory>
Adding a validation option (--validate or -val)
md-links <path/to/directory> --validate
Get stats about how many links and broken links exist
md-links <path/to/directory> --stats
# validate and return stats
md-links <path/to/directory> --validate --stats
Basic Cases
[valid link](http://test.com)
[test-link@test.com](http://test.com/test-link?djdjd&)
[title (parenthesis)](http://www.test.com)
[title with
linebreak](http://test.com)
Extra Cases
[[extra sq bracket](https://test.com?g=154&fh=!445?)
Video Case
Find image and video url
[![Solution Temperature converter](https://i.ytimg.com/vi/Ix6VLiBcABw/0.jpg)](https://www.youtube.com/watch?v=Ix6VLiBcABw)
Unsupported Cases
[extra sq bracket - invalid]](https://test.com)
[link with linebreak - invalid](http:
//test.com)
FAQs
This library allows you to find links within markdown files
We found that @raulingg/md-links demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.