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

mehdown

Package Overview
Dependencies
Maintainers
2
Versions
135
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mehdown - npm Package Compare versions

Comparing version 2.0.3 to 2.0.4

17

lib/plugins/images.js

@@ -15,13 +15,16 @@ const url = require('url');

if (hrefIndex !== -1) {
var nextToken = tokens[idx + 1];
var uri = url.parse(token.attrs[hrefIndex][1]);
if (uri && uri.pathname) {
var filename = uri.pathname.split('/').pop();
var extension = filename.toLowerCase().split('.').pop();
if (nextToken && nextToken.content === decodeURI(uri.href)) {
if (uri && uri.pathname) {
var filename = uri.pathname.split('/').pop();
var extension = filename.toLowerCase().split('.').pop();
if (extension && imageFileExtensions.indexOf(extension) !== -1) {
tokens[idx + 1].content = '';
tokens[idx + 2].hidden = true;
if (extension && imageFileExtensions.indexOf(extension) !== -1) {
tokens[idx + 1].content = '';
tokens[idx + 2].hidden = true;
return `<img src="${uri.href}" />`;
return `<img src="${uri.href}" />`;
}
}

@@ -28,0 +31,0 @@ }

@@ -20,3 +20,3 @@ {

},
"version": "2.0.3"
"version": "2.0.4"
}

@@ -54,2 +54,9 @@ const assert = require('assert');

});
it('should not render image tags for image URLs in Markdown URL syntax', function(done) {
mehdown.render('[Fold out back](https://res.cloudinary.com/mediocre/image/upload/v1463770987/poaddeitz7s97sz47s7z.jpg)', function(err, html) {
assert.equal(html, '<p><a href="https://res.cloudinary.com/mediocre/image/upload/v1463770987/poaddeitz7s97sz47s7z.jpg">Fold out back</a></p>');
done();
});
});
});
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