Skip to content

Commit e7242c4

Browse files
committed
Experiments with newlines. Still needs some tweaking.
1 parent d1a9cfc commit e7242c4

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

jquery.markedit.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,10 @@
358358
'preview': 'toolbar', // Possible values: toolbar, bottom || below, above || top, false
359359
'history': true,
360360

361+
// markup
362+
'newlineToBr': true,
363+
'noPWrap': true,
364+
361365
// functions
362366
'addHistoryButtons': true,
363367
'toolbar': $(this).markeditToolbar.defaults,
@@ -835,7 +839,15 @@
835839
var textarea = MarkEdit.getTextArea(this);
836840
var text = $(textarea).val();
837841
if (typeof(text) !== 'undefined') {
838-
return MarkEditShowDown.makeHtml($(this).val());
842+
var html = MarkEditShowDown.makeHtml($(this).val());
843+
844+
// Convert newlines to <br/>
845+
//html = html.replace(/(<p>.*)\n(.*<\/p>)/g, '$1<br/>$3');
846+
847+
// Drop wrapped <p> tags
848+
//html = html.replace(/^<p>/g, '').replace(/<\/p>$/g, '');
849+
850+
return html;
839851
}
840852
else {
841853
return '';

0 commit comments

Comments
 (0)