mirror of
https://github.com/sparksuite/simplemde-markdown-editor.git
synced 2025-09-24 16:40:55 -06:00
Merge e22ae5a8ec835d92a965a92de273bc225b4b21ac into 6abda7ab68cc20f4aca870eb243747951b90ab04
This commit is contained in:
commit
63c22a99bc
@ -16326,6 +16326,11 @@ function SimpleMDE(options) {
|
|||||||
// Add default preview rendering function
|
// Add default preview rendering function
|
||||||
if(!options.previewRender) {
|
if(!options.previewRender) {
|
||||||
options.previewRender = function(plainText) {
|
options.previewRender = function(plainText) {
|
||||||
|
|
||||||
|
//Converting every ">" and "<" characters in the whole editor to their html entities name
|
||||||
|
plainText = plainText.replace(/[<]/g, "<");
|
||||||
|
plainText = plainText.replace(/[>]/g, ">");
|
||||||
|
|
||||||
// Note: "this" refers to the options object
|
// Note: "this" refers to the options object
|
||||||
return this.parent.markdown(plainText);
|
return this.parent.markdown(plainText);
|
||||||
};
|
};
|
||||||
@ -16393,6 +16398,11 @@ SimpleMDE.prototype.markdown = function(text) {
|
|||||||
|
|
||||||
if(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) {
|
markedOptions.highlight = function(code) {
|
||||||
|
|
||||||
|
//Reverse the html entities back to normal only for the characters in a code block
|
||||||
|
code = code.replace(/\</g, "<");
|
||||||
|
code = code.replace(/\>/g, ">");
|
||||||
|
|
||||||
return window.hljs.highlightAuto(code).value;
|
return window.hljs.highlightAuto(code).value;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user