hexo-renderer-markdown-it
Advanced tools
Comparing version
'use strict'; | ||
var renderer = require('./lib/renderer'); | ||
@@ -4,0 +3,0 @@ |
'use strict'; | ||
var MarkdownIt = require('markdown-it'); | ||
var anchor = require('markdown-it-anchor'); | ||
var assign = require('object-assign'); | ||
module.exports = function (data, options) { | ||
var MarkdownIt = require('markdown-it'); | ||
var opts = (this.config.markdown) ? this.config.markdown : 'default'; | ||
var parser = (opts === 'default' || opts === 'commonmark' || opts === 'zero') ? new MarkdownIt(opts) : new MarkdownIt(opts.render); | ||
var markConfig; | ||
var md; | ||
if (this.config.markdown) { | ||
markConfig = this.config.markdown; | ||
} else { | ||
markConfig = 'commonmark'; | ||
if(opts.plugins) { | ||
parser = opts.plugins.reduce(function(parser, pugs){ | ||
return parser.use(require(pugs)); | ||
}, parser); | ||
} | ||
if (markConfig == 'commonmark' || markConfig == 'zero' || markConfig == 'default') { | ||
md = new MarkdownIt(markConfig); | ||
} else { | ||
md = new MarkdownIt(assign({}, markConfig.render, options)); | ||
if(opts.anchors) { | ||
parser.use(require('markdown-it-anchor'), opts.anchors); | ||
} | ||
if(markConfig.plugins) { | ||
md = markConfig.plugins.reduce(function(md, p){ | ||
return md.use(require(p)); | ||
}, md); | ||
} | ||
if(markConfig.anchors) { | ||
return md.use(anchor, markConfig.anchors).render(data.text); | ||
} else { | ||
return md.render(data.text); | ||
} | ||
return parser.render(data.text); | ||
}; |
{ | ||
"name": "hexo-renderer-markdown-it", | ||
"version": "3.0.3", | ||
"version": "3.1.0", | ||
"description": "Markdown-it is a Markdown parser, done right. A faster and CommonMark compliant alternative for Hexo.", | ||
@@ -36,5 +36,5 @@ "main": "index", | ||
"markdown-it-footnote": "^1.0.0", | ||
"markdown-it-ins": "^1.0.0", | ||
"markdown-it-sub": "^1.0.0", | ||
"markdown-it-sup": "^1.0.0", | ||
"object-assign": "^2.0.0" | ||
"markdown-it-sup": "^1.0.0" | ||
}, | ||
@@ -44,2 +44,3 @@ "devDependencies": { | ||
"coveralls": "^2.11.2", | ||
"del": "^1.1.1", | ||
"gulp": "^3.8.11", | ||
@@ -50,7 +51,5 @@ "gulp-istanbul": "^0.7.0", | ||
"gulp-mocha": "^2.0.1", | ||
"hexo-util": "^0.1.6", | ||
"jshint-stylish": "^1.0.1", | ||
"mocha": "^2.2.1", | ||
"rimraf": "^2.3.2" | ||
"mocha": "^2.2.1" | ||
} | ||
} |
@@ -5,3 +5,3 @@ # hexo-renderer-markdown-it | ||
This plugin uses [Markdown-it] as a render engine on [Hexo]. Adds support for [Markdown] and [CommonMark]. | ||
This renderer plugin uses [Markdown-it] as a render engine on [Hexo]. Adds support for [Markdown] and [CommonMark]. | ||
@@ -17,10 +17,19 @@ ## Documentation | ||
- Footnotes | ||
- Sub & Sup | ||
- `<sub>` & `<sup>` | ||
- `<ins>` | ||
## Installation | ||
You can install `hexo-renderer-markdown-it` by following [these steps in the documentation](https://github.com/celsomiranda/hexo-renderer-markdown-it/wiki/Getting-Started) | ||
You can install `hexo-renderer-markdown-it` by following [these steps in the documentation](https://github.com/celsomiranda/hexo-renderer-markdown-it/wiki/Getting-Started). | ||
## Requests | ||
If you have any requests please file an [issue](https://github.com/celsomiranda/hexo-renderer-markdown-it/issues). | ||
It's also the place to go if you want to know more about how `hexo-renderer-markdown-it` works. | ||
## Requests and bug reports | ||
If you have any feature requests or bugs to report, [you're welcome to file an issue](https://github.com/celsomiranda/hexo-renderer-markdown-it/issues). | ||
## Changelog | ||
###3.1.0 | ||
- Added support for `<ins>` tag | ||
- Refactored the renderer | ||
- Refactored the tests | ||
[CommonMark]: http://commonmark.org/ | ||
@@ -27,0 +36,0 @@ [Markdown]: http://daringfireball.net/projects/markdown/ |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
5858
4.83%10
-9.09%7
16.67%37
32.14%24
-35.14%+ Added
+ Added
- Removed
- Removed