mirror of
https://github.com/sparksuite/simplemde-markdown-editor.git
synced 2025-09-24 16:40:55 -06:00
Merge 31d30dbec3fb2f78bab5c4caada123d319cae1be into 6abda7ab68cc20f4aca870eb243747951b90ab04
This commit is contained in:
commit
95fee4b627
@ -97,6 +97,7 @@ simplemde.value("This text will appear in the editor");
|
|||||||
- **promptURLs**: If set to `true`, a JS alert window appears asking for the link or image URL. Defaults to `false`.
|
- **promptURLs**: If set to `true`, a JS alert window appears asking for the link or image URL. Defaults to `false`.
|
||||||
- **renderingConfig**: Adjust settings for parsing the Markdown during previewing (not editing).
|
- **renderingConfig**: Adjust settings for parsing the Markdown during previewing (not editing).
|
||||||
- **singleLineBreaks**: If set to `false`, disable parsing GFM single line breaks. Defaults to `true`.
|
- **singleLineBreaks**: If set to `false`, disable parsing GFM single line breaks. Defaults to `true`.
|
||||||
|
- **sanitize**: If set to `true`, enable sanitizing on the preview. e.g. '<br/>' will be render as text instead of a line-break
|
||||||
- **codeSyntaxHighlighting**: If set to `true`, will highlight using [highlight.js](https://github.com/isagalaev/highlight.js). Defaults to `false`. To use this feature you must include highlight.js on your page. For example, include the script and the CSS files like:<br>`<script src="https://cdn.jsdelivr.net/highlight.js/latest/highlight.min.js"></script>`<br>`<link rel="stylesheet" href="https://cdn.jsdelivr.net/highlight.js/latest/styles/github.min.css">`
|
- **codeSyntaxHighlighting**: If set to `true`, will highlight using [highlight.js](https://github.com/isagalaev/highlight.js). Defaults to `false`. To use this feature you must include highlight.js on your page. For example, include the script and the CSS files like:<br>`<script src="https://cdn.jsdelivr.net/highlight.js/latest/highlight.min.js"></script>`<br>`<link rel="stylesheet" href="https://cdn.jsdelivr.net/highlight.js/latest/styles/github.min.css">`
|
||||||
- **shortcuts**: Keyboard shortcuts associated with this instance. Defaults to the [array of shortcuts](#keyboard-shortcuts).
|
- **shortcuts**: Keyboard shortcuts associated with this instance. Defaults to the [array of shortcuts](#keyboard-shortcuts).
|
||||||
- **showIcons**: An array of icon names to show. Can be used to show specific icons hidden by default without completely customizing the toolbar.
|
- **showIcons**: An array of icon names to show. Can be used to show specific icons hidden by default without completely customizing the toolbar.
|
||||||
@ -152,6 +153,7 @@ var simplemde = new SimpleMDE({
|
|||||||
promptURLs: true,
|
promptURLs: true,
|
||||||
renderingConfig: {
|
renderingConfig: {
|
||||||
singleLineBreaks: false,
|
singleLineBreaks: false,
|
||||||
|
sanitize: true,
|
||||||
codeSyntaxHighlighting: true,
|
codeSyntaxHighlighting: true,
|
||||||
},
|
},
|
||||||
shortcuts: {
|
shortcuts: {
|
||||||
|
@ -1402,6 +1402,12 @@ SimpleMDE.prototype.markdown = function(text) {
|
|||||||
markedOptions.breaks = true;
|
markedOptions.breaks = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(this.options && this.options.renderingConfig && this.options.renderingConfig.sanitize === true) {
|
||||||
|
markedOptions.sanitize = true;
|
||||||
|
} else {
|
||||||
|
markedOptions.sanitize = false;
|
||||||
|
}
|
||||||
|
|
||||||
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) {
|
||||||
return window.hljs.highlightAuto(code).value;
|
return window.hljs.highlightAuto(code).value;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user