Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

markdown-link-check

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

markdown-link-check - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

12

index.js

@@ -8,4 +8,12 @@ 'use strict';

module.exports = function markdownLinkCheck(markdown, callback) {
async.map(_.uniq(markdownLinkExtractor(markdown)), linkCheck, callback);
module.exports = function markdownLinkCheck(markdown, opts, callback) {
if (arguments.length === 2 && typeof opts === 'function') {
// optional 'opts' not supplied.
callback = opts;
opts = {};
}
async.map(_.uniq(markdownLinkExtractor(markdown)), function (link, callback) {
linkCheck(link, opts, callback);
}, callback);
};

4

package.json
{
"name": "markdown-link-check",
"version": "1.1.0",
"version": "1.2.0",
"description": "checks the all of the hyperlinks in a markdown text to determine if they are alive or dead",

@@ -36,3 +36,3 @@ "bin": {

"commander": "^2.9.0",
"link-check": "^2.0.2",
"link-check": "^2.1.0",
"markdown-link-extractor": "^1.1.0",

@@ -39,0 +39,0 @@ "request": "^2.72.0",

@@ -18,3 +18,3 @@ # markdown-link-check

### markdownLinkCheck(markdown, callback)
### markdownLinkCheck(markdown, [opts,] callback)

@@ -28,2 +28,4 @@ Given a string containing `markdown` formatted text and a `callback`,

* `markdown` string containing markdown formatted text.
* `opts` optional options object containing any of the following optional fields:
* `baseUrl` the base URL for relative links.
* `callback` function which accepts `(err, results)`.

@@ -30,0 +32,0 @@ * `err` an Error object when the operation cannot be completed, otherwise `null`.

@@ -50,6 +50,6 @@ 'use strict';

it('should check the links in sample.md', function (done) {
markdownLinkCheck(fs.readFileSync(path.join(__dirname, 'sample.md')).toString().replace(/%%BASE_URL%%/g, baseUrl), function (err, results) {
markdownLinkCheck(fs.readFileSync(path.join(__dirname, 'sample.md')).toString().replace(/%%BASE_URL%%/g, baseUrl), { baseUrl: baseUrl }, function (err, results) {
expect(err).to.be(null);
expect(results).to.be.an('array');
expect(results.length).to.be(6);
expect(results.length).to.be(7);

@@ -74,2 +74,5 @@ expect(results[0].statusCode).to.be(200);

expect(results[6].statusCode).to.be(200);
expect(results[6].status).to.be('alive');
done();

@@ -76,0 +79,0 @@ });

@@ -12,1 +12,2 @@ # Sample

![img](%%BASE_URL%%/hello.jpg) (alive)
![img](hello.jpg) (alive)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc