mirror of
https://github.com/sparksuite/simplemde-markdown-editor.git
synced 2025-09-24 16:40:55 -06:00
simplify markdown
This commit is contained in:
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);
|
||||
}
|
||||
}
|
||||
|
2
dist/simplemde.min.js
vendored
2
dist/simplemde.min.js
vendored
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…
x
Reference in New Issue
Block a user