From 9e815dbef9cd7a6089d6303aa5a5c6e23d9027ef Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Tue, 1 Oct 2013 16:45:26 -0400 Subject: [PATCH] FIX: Blockquote issue --- .../discourse/dialects/fix_block_quotes.js | 16 ---------------- vendor/assets/javascripts/better_markdown.js | 7 +++++++ 2 files changed, 7 insertions(+), 16 deletions(-) delete mode 100644 app/assets/javascripts/discourse/dialects/fix_block_quotes.js diff --git a/app/assets/javascripts/discourse/dialects/fix_block_quotes.js b/app/assets/javascripts/discourse/dialects/fix_block_quotes.js deleted file mode 100644 index 87bbafa18b3..00000000000 --- a/app/assets/javascripts/discourse/dialects/fix_block_quotes.js +++ /dev/null @@ -1,16 +0,0 @@ -// There's a weird issue with the markdown parser where it won't process simple blockquotes -// when they are prefixed with spaces. This fixes it. -Discourse.Dialect.on("register", function(event) { - var dialect = event.dialect, - MD = event.MD; - - dialect.block["fix_block_quotes"] = function(block, next) { - var m = /(^|\n) +(\>[\s\S]*)/.exec(block); - if (m && m[2] && m[2].length) { - var blockContents = block.replace(/(^|\n) +\>/, "$1>"); - next.unshift(blockContents); - return []; - } - }; - -}); \ No newline at end of file diff --git a/vendor/assets/javascripts/better_markdown.js b/vendor/assets/javascripts/better_markdown.js index dd5bc2d7f0f..ab3ffaae690 100644 --- a/vendor/assets/javascripts/better_markdown.js +++ b/vendor/assets/javascripts/better_markdown.js @@ -719,6 +719,13 @@ Markdown.dialects.Gruber = { blockquote: function blockquote( block, next ) { + var m = /(^|\n) +(\>[\s\S]*)/.exec(block); + if (m && m[2] && m[2].length) { + var blockContents = block.replace(/(^|\n) +\>/, "$1>"); + next.unshift(blockContents); + return []; + } + if ( !block.match( /^>/m ) ) return undefined;