Comparing version 2.0.3 to 2.0.4
@@ -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(); | ||
}); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
83399
1193