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

bem-md-renderer

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bem-md-renderer - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

38

index.js
var marked = require('marked'),
_ = require('lodash'),
extend = require('util')._extend,
usedAnchors = {},

@@ -13,24 +13,11 @@ renderer;

function render(markdown, options, cb) {
var args = Array.prototype.slice.call(arguments);
if (!markdown || !typeof markdown === 'string') throw new Error('First argument must be a markdown string');
// check markdown string
if (!markdown) throw new Error('Markdown string should be passed in arguments');
if (!_.isString(markdown)) throw new Error('Markdown must be a string');
// check arguments length
if (args.length === 3) {
if (!_.isObject(options)) throw new Error('Options must be an object');
if (!_.isFunction(cb)) throw new Error('Callback must be a function');
} else {
if (!_.isFunction(arguments[1])) {
throw new Error('If the options is not passed, the second argument must be a callback function');
}
// set requires variables
if (typeof options === 'function') {
cb = options;
options = {};
cb = args[1];
}
// render html from markdown
marked(markdown, _.extend({
return marked(markdown, extend({
gfm: true,

@@ -40,7 +27,3 @@ pedantic: false,

renderer: getRenderer()
}, options), function (err, result) {
if (err) return cb(err);
return cb(null, result);
});
}, options), cb);
}

@@ -108,10 +91,9 @@

_.keys(services).forEach(function (service) {
// filter service by match href
var supportService = _.filter(services[service], function (link) {
Object.keys(services).forEach(function (service) {
var isSupportedService = services[service].some(function (link) {
return href.indexOf(link) > -1;
});
// href contain link to support video service
if (supportService.length) {
// href contains link to support video service
if (isSupportedService) {
result = getIframe(href, service);

@@ -118,0 +100,0 @@ return false;

{
"name": "bem-md-renderer",
"version": "0.2.0",
"version": "0.3.0",
"description": "The builder markdown to html with custom renderer, which generates the html headlines like github",

@@ -24,3 +24,2 @@ "main": "index.js",

"dependencies": {
"lodash": "^3.3.1",
"marked": "~0.3.2"

@@ -27,0 +26,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