Comparing version 2.33.2 to 2.34.0
@@ -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) { |
@@ -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" | ||
} |
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
592214
65
4707
17
+ Addedcheerio@0.22.x
+ Addedasync@2.6.4(transitive)
+ Addedboolbase@1.0.0(transitive)
+ Addedcheerio@0.22.0(transitive)
+ Addedcss-select@1.2.0(transitive)
+ Addedcss-what@2.1.3(transitive)
+ Addeddom-serializer@0.1.1(transitive)
+ Addeddomelementtype@1.3.1(transitive)
+ Addeddomhandler@2.4.2(transitive)
+ Addeddomutils@1.5.1(transitive)
+ Addedhtmlparser2@3.10.1(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedlodash.assignin@4.2.0(transitive)
+ Addedlodash.bind@4.2.1(transitive)
+ Addedlodash.defaults@4.2.0(transitive)
+ Addedlodash.filter@4.6.0(transitive)
+ Addedlodash.flatten@4.4.0(transitive)
+ Addedlodash.foreach@4.5.0(transitive)
+ Addedlodash.map@4.6.0(transitive)
+ Addedlodash.merge@4.6.2(transitive)
+ Addedlodash.pick@4.4.0(transitive)
+ Addedlodash.reduce@4.6.0(transitive)
+ Addedlodash.reject@4.6.0(transitive)
+ Addedlodash.some@4.6.0(transitive)
+ Addednth-check@1.0.2(transitive)
+ Addedreadable-stream@3.6.2(transitive)
+ Addedstring_decoder@1.3.0(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
- Removedasync@2.5.0(transitive)
Updatedasync@2.6.x