diff --git a/index.js b/index.js index 0b6cc2c..bc13d19 100644 --- a/index.js +++ b/index.js @@ -2,7 +2,9 @@ var hljs = require('highlight.js'); var utils = require('handlebars-utils'); -var Remarkable = require('remarkable'); +const { Remarkable } = require('remarkable'); +const { linkify } = require('remarkable/linkify'); + var defaults = { html: true, breaks: true, highlight: highlight }; module.exports = function(config) { @@ -30,7 +32,14 @@ module.exports = function(config) { opts.langPrefix = opts.lang; } - var md = new Remarkable(opts); + const useLinkify = opts.linkify; + delete opts.linkify; + + let md = new Remarkable(opts); + if (useLinkify) { + md.use(linkify); + } + var val = utils.value(str, ctx, options); return md.render(val); } diff --git a/package.json b/package.json index 812bd03..f8df54b 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "dependencies": { "handlebars-utils": "^1.0.2", "highlight.js": "^9.12.0", - "remarkable": "^1.7.1" + "remarkable": "^2.0.1" }, "devDependencies": { "gulp-format-md": "^1.0.0",