spectacle/app/helpers/md.js
Kam e11adc7f3a Fix #122 and #126 markdown rendering issues
Improve the way schema descriptions are rendered and linked
2018-03-21 09:09:34 +01:00

17 lines
688 B
JavaScript

var Handlebars = require('handlebars')
var common = require('../lib/common')
/**
* Render a markdown formatted text as HTML.
* @param {string} `value` the markdown-formatted text
* @param {boolean} `options.hash.stripParagraph` the marked-md-renderer wraps generated HTML in a <p>-tag by default.
* If this options is set to true, the <p>-tag is stripped.
* @returns {Handlebars.SafeString} a Handlebars-SafeString containing the provieded
* markdown, rendered as HTML.
*/
module.exports = function(value, options) {
value = value + ''
var html = common.markdown(value, options.hash ? options.hash.stripParagraph : false)
return new Handlebars.SafeString(html)
};