From f3f928084e527263b3d25625d93e5b9e6a317b22 Mon Sep 17 00:00:00 2001 From: Titus Date: Thu, 14 Jun 2012 00:09:58 -0600 Subject: [PATCH] Fixed #21 -- Github codeblocks can now contain back ticks --- src/showdown.js | 2 +- test/cases/github-style-codeblock.html | 2 +- test/cases/github-style-codeblock.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/showdown.js b/src/showdown.js index 6c51a3a..2b9d632 100644 --- a/src/showdown.js +++ b/src/showdown.js @@ -905,7 +905,7 @@ var _DoGithubCodeBlocks = function(text) { // attacklab: sentinel workarounds for lack of \A and \Z, safari\khtml bug text += "~0"; - text = text.replace(/(?:^|\n)```(.*)\n([^`]+)\n```/g, + text = text.replace(/(?:^|\n)```(.*)\n([\s\S]*?)\n```/g, function(wholeMatch,m1,m2) { var language = m1; var codeblock = m2; diff --git a/test/cases/github-style-codeblock.html b/test/cases/github-style-codeblock.html index 39d1fa0..fc4187e 100644 --- a/test/cases/github-style-codeblock.html +++ b/test/cases/github-style-codeblock.html @@ -3,7 +3,7 @@

Define a function in javascript:

function MyFunc(a) {
-    // ...
+    var s = '`';
 }
 
diff --git a/test/cases/github-style-codeblock.md b/test/cases/github-style-codeblock.md index 5c59c1d..ce4ecc5 100644 --- a/test/cases/github-style-codeblock.md +++ b/test/cases/github-style-codeblock.md @@ -3,7 +3,7 @@ Define a function in javascript: ``` function MyFunc(a) { - // ... + var s = '`'; } ```