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

mehdown

Package Overview
Dependencies
Maintainers
6
Versions
134
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.33.2 to 2.34.0

lib/plugins/woot.js

11

lib/index.js

@@ -16,2 +16,3 @@ const url = require('url');

const textify = require('textify');
const woot = require('./plugins/woot');
const xkcd = require('./plugins/xkcd');

@@ -690,2 +691,3 @@ const youtubeSearch = require('youtube-search');

md.use(require('./plugins/vine'));
md.use(woot.markdown);
md.use(xkcd.markdown);

@@ -702,2 +704,11 @@ md.use(require('./plugins/youtube'));

function(callback) {
woot.postMarkdown(html, function(err, _html) {
if (!err && _html) {
html = _html;
}
callback();
});
},
function(callback) {
xkcd.postMarkdown(html, function(err, _html) {

@@ -704,0 +715,0 @@ if (!err && _html) {

52

lib/plugins/xkcd.js

@@ -9,36 +9,36 @@ const async = require('async');

markdown: function(md) {
var defaultRender = md.renderer.rules.link_open || function(tokens, idx, options, env, self) {
return self.renderToken(tokens, idx, options);
};
var defaultRender = md.renderer.rules.link_open || function(tokens, idx, options, env, self) {
return self.renderToken(tokens, idx, options);
};
md.renderer.rules.link_open = function(tokens, idx, options, env, self) {
var openToken = tokens[idx];
var hrefIndex = openToken.attrIndex('href');
md.renderer.rules.link_open = function(tokens, idx, options, env, self) {
var openToken = tokens[idx];
var hrefIndex = openToken.attrIndex('href');
// Ensure we have an "href" attribute
if (hrefIndex !== -1) {
var href = openToken.attrs[hrefIndex][1];
// Ensure we have an "href" attribute
if (hrefIndex !== -1) {
var href = openToken.attrs[hrefIndex][1];
// Ensure we have an "href" attribute value
if (href) {
var textToken = tokens[idx + 1];
// Ensure we have an "href" attribute value
if (href) {
var textToken = tokens[idx + 1];
// Ensure we have a text token and the text matches the URL pattern instead of [text](http://example.com/)
if (textToken && textToken.content && regExp.test(textToken.content)) {
var matches = href.match(regExp);
// Ensure we have a text token and the text matches the URL pattern instead of [text](http://example.com/)
if (textToken && textToken.content && regExp.test(textToken.content)) {
var matches = href.match(regExp);
if (matches) {
var xkcd = matches[0];
if (matches) {
var xkcd = matches[0];
textToken.content = '';
tokens[idx + 2].hidden = true;
textToken.content = '';
tokens[idx + 2].hidden = true;
return `<a class="xkcd-embed" href="${xkcd}">${xkcd}</a>`;
}
}
}
}
return `<a class="xkcd-embed" href="${xkcd}">${xkcd}</a>`;
}
}
}
}
return defaultRender(tokens, idx, options, env, self);
};
return defaultRender(tokens, idx, options, env, self);
};
},

@@ -45,0 +45,0 @@ postMarkdown: function(html, callback) {

{
"dependencies": {
"async": "2.5.x",
"async": "2.6.x",
"cheerio": "0.22.x",
"emojione": "3.0.3",

@@ -36,3 +37,3 @@ "flip": "1.0.x",

},
"version": "2.33.2"
"version": "2.34.0"
}
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