diff --git a/docs/args/index.mustache b/docs/args/index.mustache index 6037b530..5d1c2a90 100644 --- a/docs/args/index.mustache +++ b/docs/args/index.mustache @@ -261,8 +261,8 @@ See below for more examples. `markdown` - Options to pass to Marked, the Markdown compiler used to compile API descriptions. - See the Marked readme for details. + Options to pass to markdown-it, the Markdown compiler used to compile API descriptions. + See the markdown-it API for details. diff --git a/lib/builder.js b/lib/builder.js index 43457c4c..aceb2aa7 100644 --- a/lib/builder.js +++ b/lib/builder.js @@ -3,7 +3,7 @@ * Code licensed under the BSD License: * https://github.com/yui/yuidoc/blob/master/LICENSE */ -var marked = require('marked'), +var MarkdownIt = require('markdown-it'), fs = require('graceful-fs'), noop = function () {}, path = require('path'), @@ -54,7 +54,7 @@ YUI.add('doc-builder', function (Y) { if (options.themedir) { themeDir = options.themedir; } - + this.md = new MarkdownIt(options.markdown); this.data = data; Y.log('Building..', 'info', 'builder'); this.files = 0; @@ -138,16 +138,15 @@ YUI.add('doc-builder', function (Y) { * Wrapper around the Markdown parser so it can be normalized or even side stepped * @method markdown * @private - * @param {String} md The Markdown string to parse + * @param {String} data The Markdown string to parse * @return {HTML} The rendered HTML */ - markdown: function (md) { - var html = marked(md, this.options.markdown); + markdown: function (data) { + var html = this.md.render(data); //Only reprocess if helpers were asked for if (this.options.helpers || (html.indexOf('{{#crossLink') > -1)) { - //console.log('MD: ', html); try { - // marked auto-escapes quotation marks (and unfortunately + // markdown-it auto-escapes quotation marks (and unfortunately // does not expose the escaping function) html = html.replace(/"/g, "\""); html = (Y.Handlebars.compile(html))({}); @@ -156,7 +155,6 @@ YUI.add('doc-builder', function (Y) { html = html.replace(/\\{/g, '{').replace(/\\}/g, '}'); Y.log('Failed to parse Handlebars, probably an unknown helper, skipping..', 'warn', 'builder'); } - //console.log('HB: ', html); } return html; }, diff --git a/package.json b/package.json index ddc1ebcb..351fb884 100644 --- a/package.json +++ b/package.json @@ -72,7 +72,7 @@ "dependencies": { "express": "^4.10.1", "graceful-fs": "2.x", - "marked": "^0.3.3", + "markdown-it": "^3.0.7", "minimatch": "^2.0.1", "rimraf": "2.x", "yui": "^3.18.1"