META-INF.resources.butterfaces-js.butterfaces-markdown.jquery.js Maven / Gradle / Ivy
(function ($) {
// extend jQuery --------------------------------------------------------------------
$.fn.markdownReadonly = function () {
var root = $(this);
var $readonlyMarkdown = root.find('.butter-component-value-readonly-wrapper');
var markdownText = $readonlyMarkdown.html()
.replace('&', '&')
.replace('<', '<')
.replace('>', '>');
var markdownTextToHtml = new showdown.Converter().makeHtml(markdownText);
$readonlyMarkdown.empty();
$readonlyMarkdown.append(markdownTextToHtml);
};
}(jQuery));