From cbeb630a97651a110d6e5ce6a74a280356598704 Mon Sep 17 00:00:00 2001 From: Wes Cossick Date: Mon, 31 Aug 2015 23:53:32 -0500 Subject: [PATCH] Add singleLineBreaks option --- README.md | 2 ++ src/js/simplemde.js | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0f8ef4e..820322c 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,7 @@ simplemde.value(); - **tabSize**: If set, customize the tab size. Defaults to `2`. - **initialValue**: If set, will customize the initial value of the editor. - **spellChecker**: If set to `false`, disable the spell checker. Defaults to `true`. +- **singleLineBreaks**: If set to `false`, disable parsing GFM single line breaks. Defaults to `true`. - **autosave**: *Saves the text that's being written. It will forget the text when the form is submitted.* - **enabled**: If set to `true`, autosave the text. Defaults to `false`. - **unique_id**: You must set a unique identifier so that SimpleMDE can autosave. Something that separates this from other textareas. @@ -85,6 +86,7 @@ var simplemde = new SimpleMDE({ tabSize: 4, initialValue: "Hello world!", spellChecker: false, + singleLineBreaks: false, autosave: { enabled: true, unique_id: "MyUniqueID", diff --git a/src/js/simplemde.js b/src/js/simplemde.js index 164faea..7015907 100644 --- a/src/js/simplemde.js +++ b/src/js/simplemde.js @@ -588,9 +588,11 @@ SimpleMDE.toolbar = toolbar; SimpleMDE.markdown = function(text) { if(window.marked) { // Update options - marked.setOptions({ - breaks: true - }); + if(this.options.singleLineBreaks !== false){ + marked.setOptions({ + breaks: true + }); + } return marked(text); }