New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

hexo-renderer-marked

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hexo-renderer-marked - npm Package Compare versions

Comparing version 0.1.0 to 0.2.3

lib/renderer.js

64

index.js

@@ -1,56 +0,14 @@

var marked = require('marked'),
_ = require('lodash'),
util = hexo.util,
highlight = util.highlight,
htmlTag = util.html_tag,
format = util.format,
stripHtml = format.stripHtml,
headingId = {};
var renderer = require('./lib/renderer');
var assign = require('object-assign');
var anchorId = function(str){
return str
.replace(/\s+/g, '_')
.replace(/\./g, '-')
.replace(/-{2,}/g, '-');
};
hexo.config.marked = assign({
gfm: true,
pedantic: false,
sanitize: false,
tables: true,
breaks: true,
smartLists: true,
smartypants: true
}, hexo.config.marked);
var r = new marked.Renderer();
// Add id attribute to headings
r.heading = function(text, level){
var id = anchorId(stripHtml(text));
// Add a number after id if repeated
if (headingId.hasOwnProperty(id)){
id += '-' + headingId[id];
headingId[text]++;
} else {
headingId[id] = 1;
}
return htmlTag('h' + level, {id: id}, text) + '\n';
};
marked.setOptions({
renderer: r,
langPrefix: '',
highlight: function(code, lang){
return highlight(code, {lang: lang, gutter: false, wrap: false});
}
});
var renderer = function(data, options){
headingId = {};
return marked(data.text, _.extend({
gfm: true,
pedantic: false,
sanitize: false,
tables: true,
breaks: true,
smartLists: true,
smartypants: true
}, hexo.config.marked, options));
};
hexo.extend.renderer.register('md', 'html', renderer, true);

@@ -57,0 +15,0 @@ hexo.extend.renderer.register('markdown', 'html', renderer, true);

{
"name": "hexo-renderer-marked",
"version": "0.1.0",
"version": "0.2.3",
"description": "Markdown renderer plugin for Hexo",
"main": "index",
"repository": {
"type": "git",
"url": "https://github.com/hexojs/hexo-renderer-marked.git"
"scripts": {
"test": "gulp test"
},
"bugs": {
"url": "https://github.com/hexojs/hexo-renderer-marked/issues"
"directories": {
"lib": "./lib"
},
"engines": {
"node": ">= 0.10.0"
},
"repository": "hexojs/hexo-renderer-marked",
"keywords": [

@@ -20,10 +23,21 @@ "hexo",

"author": "Tommy Chen <tommy351@gmail.com> (http://zespia.tw)",
"license": {
"type": "MIT",
"url": "https://raw.github.com/tommy351/hexo/master/LICENSE"
},
"license": "MIT",
"dependencies": {
"hexo-util": "^0.1.0",
"marked": "^0.3.2",
"lodash": "^2.4.1"
"object-assign": "^2.0.0",
"strip-indent": "^1.0.0"
},
"devDependencies": {
"chai": "^1.9.1",
"coveralls": "^2.11.2",
"gulp": "^3.8.9",
"gulp-istanbul": "^0.5.0",
"gulp-jshint": "^1.8.6",
"gulp-load-plugins": "^0.8.0",
"gulp-mocha": "^2.0.0",
"jshint-stylish": "^1.0.0",
"mocha": "^2.0.1",
"rimraf": "^2.2.8"
}
}

@@ -1,6 +0,8 @@

# [Markdown] renderer
# hexo-renderer-marked
[![Build Status](https://travis-ci.org/hexojs/hexo-renderer-marked.svg?branch=master)](https://travis-ci.org/hexojs/hexo-renderer-marked) [![NPM version](https://badge.fury.io/js/hexo-renderer-marked.svg)](http://badge.fury.io/js/hexo-renderer-marked) [![Coverage Status](https://img.shields.io/coveralls/hexojs/hexo-renderer-marked.svg)](https://coveralls.io/r/hexojs/hexo-renderer-marked?branch=master)
Add support for [Markdown]. This plugin uses [marked] as render engine.
## Install
## Installation

@@ -7,0 +9,0 @@ ``` bash

Sorry, the diff of this file is not supported yet

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