simplify markdown

pull/510/head
WittBulter 7 years ago
parent c2ee463010
commit 2c2d775a6b

File diff suppressed because one or more lines are too long

@ -16897,23 +16897,17 @@ var SimpleMDE = function (_Action) {
key: 'markdown',
value: function markdown(text) {
if (_marked2.default) {
// Initialize
var markedOptions = {};
// Update options
var update = this.options && this.options.renderingConfig && this.options.renderingConfig.singleLineBreaks === false;
markedOptions.breaks = !update;
if (this.options && this.options.renderingConfig && this.options.renderingConfig.codeSyntaxHighlighting === true && window.hljs) {
markedOptions.highlight = function (code) {
return window.hljs.highlightAuto(code).value;
};
}
var highlight = this.options && this.options.renderingConfig && this.options.renderingConfig.codeSyntaxHighlighting === true && window.hljs;
// Set options
_marked2.default.setOptions(markedOptions);
// Return
_marked2.default.setOptions({
breaks: !update,
highlight: highlight ? function (code) {
return window.hljs.highlightAuto(code).value;
} : undefined
});
return (0, _marked2.default)(text);
}
}

File diff suppressed because one or more lines are too long

@ -157,21 +157,15 @@ class SimpleMDE extends Action {
*/
markdown(text) {
if(marked) {
// Initialize
let markedOptions = {};
// Update options
const update = this.options && this.options.renderingConfig && this.options.renderingConfig.singleLineBreaks === false
markedOptions.breaks = !update
if(this.options && this.options.renderingConfig && this.options.renderingConfig.codeSyntaxHighlighting === true && window.hljs) {
markedOptions.highlight = code => window.hljs.highlightAuto(code).value
}
const highlight = this.options && this.options.renderingConfig && this.options.renderingConfig.codeSyntaxHighlighting === true && window.hljs
// Set options
marked.setOptions(markedOptions);
// Return
marked.setOptions({
breaks: !update,
highlight: highlight ? code => window.hljs.highlightAuto(code).value : undefined
});
return marked(text);
}
};

Loading…
Cancel
Save