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; idef self.parse(text)\n\n text\nend
hello `eviltrout`
",
+ "it allows code with backticks in it");
});
test("SanitizeHTML", function() {