mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
FIX: New line insertion when a line begins with []
This commit is contained in:
parent
982b763216
commit
f84630a54d
2 changed files with 10 additions and 3 deletions
|
@ -100,7 +100,7 @@ Discourse.Markdown = {
|
|||
// Linebreaks
|
||||
var linebreaks = opts.traditional_markdown_linebreaks || Discourse.SiteSettings.traditional_markdown_linebreaks;
|
||||
if (!linebreaks) {
|
||||
text = text.replace(/(^[\w<][^\n]*\n+)/gim, function(t) {
|
||||
text = text.replace(/(^[\w<\[][^\n]*\n+)/gim, function(t) {
|
||||
if (t.match(/\n{2}/gim)) return t;
|
||||
return t.replace("\n", " \n");
|
||||
});
|
||||
|
|
|
@ -20,7 +20,7 @@ test("basic cooking", function() {
|
|||
cooked("***hello***", "<p><strong><em>hello</em></strong></p>", "it can do bold and italics at once.");
|
||||
});
|
||||
|
||||
test("Line Breaks", function() {
|
||||
test("Traditional Line Breaks", function() {
|
||||
|
||||
var input = "1\n2\n3";
|
||||
cooked(input, "<p>1<br>2<br>3</p>", "automatically handles trivial newlines");
|
||||
|
@ -34,9 +34,16 @@ test("Line Breaks", function() {
|
|||
|
||||
Discourse.SiteSettings.traditional_markdown_linebreaks = true;
|
||||
cooked(input, traditionalOutput, "It supports traditional markdown via a Site Setting");
|
||||
|
||||
});
|
||||
|
||||
test("Line Breaks", function() {
|
||||
|
||||
cooked("[] first choice\n[] second choice",
|
||||
"<p>[] first choice<br>[] second choice</p>",
|
||||
"it handles new lines correctly with [] options");
|
||||
});
|
||||
|
||||
|
||||
test("Links", function() {
|
||||
|
||||
cooked("EvilTrout: http://eviltrout.com",
|
||||
|
|
Loading…
Reference in a new issue