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',
|
key: 'markdown',
|
||||||
value: function markdown(text) {
|
value: function markdown(text) {
|
||||||
if (_marked2.default) {
|
if (_marked2.default) {
|
||||||
// Initialize
|
|
||||||
var markedOptions = {};
|
|
||||||
|
|
||||||
// Update options
|
// Update options
|
||||||
var update = this.options && this.options.renderingConfig && this.options.renderingConfig.singleLineBreaks === false;
|
var update = this.options && this.options.renderingConfig && this.options.renderingConfig.singleLineBreaks === false;
|
||||||
markedOptions.breaks = !update;
|
var highlight = this.options && this.options.renderingConfig && this.options.renderingConfig.codeSyntaxHighlighting === true && window.hljs;
|
||||||
|
|
||||||
if (this.options && this.options.renderingConfig && this.options.renderingConfig.codeSyntaxHighlighting === true && window.hljs) {
|
|
||||||
markedOptions.highlight = function (code) {
|
|
||||||
return window.hljs.highlightAuto(code).value;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set options
|
// Set options
|
||||||
_marked2.default.setOptions(markedOptions);
|
_marked2.default.setOptions({
|
||||||
|
breaks: !update,
|
||||||
// Return
|
highlight: highlight ? function (code) {
|
||||||
|
return window.hljs.highlightAuto(code).value;
|
||||||
|
} : undefined
|
||||||
|
});
|
||||||
return (0, _marked2.default)(text);
|
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) {
|
markdown(text) {
|
||||||
if(marked) {
|
if(marked) {
|
||||||
// Initialize
|
|
||||||
let markedOptions = {};
|
|
||||||
|
|
||||||
// Update options
|
// Update options
|
||||||
const update = this.options && this.options.renderingConfig && this.options.renderingConfig.singleLineBreaks === false
|
const update = this.options && this.options.renderingConfig && this.options.renderingConfig.singleLineBreaks === false
|
||||||
markedOptions.breaks = !update
|
const highlight = this.options && this.options.renderingConfig && this.options.renderingConfig.codeSyntaxHighlighting === true && window.hljs
|
||||||
|
|
||||||
if(this.options && this.options.renderingConfig && this.options.renderingConfig.codeSyntaxHighlighting === true && window.hljs) {
|
|
||||||
markedOptions.highlight = code => window.hljs.highlightAuto(code).value
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set options
|
// Set options
|
||||||
marked.setOptions(markedOptions);
|
marked.setOptions({
|
||||||
|
breaks: !update,
|
||||||
// Return
|
highlight: highlight ? code => window.hljs.highlightAuto(code).value : undefined
|
||||||
|
});
|
||||||
return marked(text);
|
return marked(text);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user