diff --git a/app/assets/javascripts/discourse/dialects/github_code_dialect.js b/app/assets/javascripts/discourse/dialects/github_code_dialect.js index c83d21d68ed..2c82cd65dcd 100644 --- a/app/assets/javascripts/discourse/dialects/github_code_dialect.js +++ b/app/assets/javascripts/discourse/dialects/github_code_dialect.js @@ -49,26 +49,28 @@ Discourse.Dialect.on("register", function(event) { blockLine = b.lineNumber, diff = ((typeof blockLine === "undefined") ? lineNumber : blockLine) - lineNumber; - b = b.replace(/ {2}\n/g, "\n"); - var n = b.match(/([^`]*)```([^`]*)/m); + var endFound = b.indexOf('```'), + leadingCode = b.slice(0, endFound), + trailingCode = b.slice(endFound+3); for (var i=1; i
def self.parse(text)\n\n  text\nend

", "it allows leading spaces on lines in a code block."); + + cooked("```ruby\nhello `eviltrout`\n```", + "

hello `eviltrout`

", + "it allows code with backticks in it"); }); test("SanitizeHTML", function() {