hexo-renderer-marked
Advanced tools
Comparing version 0.2.7 to 0.2.8
@@ -7,2 +7,3 @@ 'use strict'; | ||
var util = require('hexo-util'); | ||
var highlight = util.highlight; | ||
@@ -12,6 +13,8 @@ var stripHTML = util.stripHTML; | ||
function Renderer() { | ||
MarkedRenderer.apply(this, arguments); | ||
function Renderer(ctx) { | ||
MarkedRenderer.apply(this); | ||
this._headingId = {}; | ||
this.ctx = ctx; | ||
this.url_for = ctx.extend.helper.get('url_for'); | ||
} | ||
@@ -36,2 +39,12 @@ | ||
Renderer.prototype.link = function(href, title, text) { | ||
href = this.url_for.call(this.ctx, href); | ||
return MarkedRenderer.prototype.link.call(this, href, title, text); | ||
}; | ||
Renderer.prototype.image = function(href, title, text) { | ||
href = this.url_for.call(this.ctx, href); | ||
return MarkedRenderer.prototype.image.call(this, href, title, text); | ||
}; | ||
function anchorId(str) { | ||
@@ -42,3 +55,5 @@ // Add support for Chinese | ||
.replace(/\./g, '-') | ||
.replace(/-{2,}/g, '-')).replace(/%/g, '_').replace(/^[\-_]+|[\-_]+$/g, ''); | ||
.replace(/-{2,}/g, '-')) | ||
.replace(/%/g, '_') | ||
.replace(/^[\-_]+|[\-_]+$/g, ''); | ||
} | ||
@@ -59,4 +74,4 @@ | ||
return marked(data.text, assign({ | ||
renderer: new Renderer() | ||
renderer: new Renderer(this) | ||
}, this.config.marked, options)); | ||
}; |
{ | ||
"name": "hexo-renderer-marked", | ||
"version": "0.2.7", | ||
"version": "0.2.8", | ||
"description": "Markdown renderer plugin for Hexo", | ||
@@ -5,0 +5,0 @@ "main": "index", |
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
6501
80
1