diff --git a/app/assets/javascripts/discourse/components/markdown.js b/app/assets/javascripts/discourse/components/markdown.js index 373df516ca4..14b64a24405 100644 --- a/app/assets/javascripts/discourse/components/markdown.js +++ b/app/assets/javascripts/discourse/components/markdown.js @@ -102,6 +102,11 @@ Discourse.Markdown = { var quoteTemplate = null, urlsTemplate = null; // Before cooking callbacks + converter.hooks.chain("preConversion", function(text) { + // If a user puts text right up against a quote, make sure the spacing is equivalnt to a new line + return text.replace(/\[\/quote\]/, "[/quote]\n"); + }); + converter.hooks.chain("preConversion", function(text) { Discourse.Markdown.trigger('beforeCook', { detail: text, opts: opts }); return Discourse.Markdown.textResult || text; diff --git a/test/javascripts/components/markdown_test.js b/test/javascripts/components/markdown_test.js index 2b6d7c9f832..0b44cec4c28 100644 --- a/test/javascripts/components/markdown_test.js +++ b/test/javascripts/components/markdown_test.js @@ -69,13 +69,13 @@ test("Quotes", function() { cookedOptions("1[quote=\"bob, post:1\"]my quote[/quote]2", { topicId: 2, lookupAvatar: function(name) { return "" + name; } }, "

1

\n


\n2

", + " bob\n bob\n said:\n \n
my quote
\n\n

\n\n

2

", "handles quotes properly"); cookedOptions("1[quote=\"bob, post:1\"]my quote[/quote]2", { topicId: 2, lookupAvatar: function(name) { } }, "

1

\n


\n2

", + " \n bob\n said:\n \n
my quote
\n\n

\n\n

2

", "includes no avatar if none is found"); });