Bläddra i källkod

Fixed #21 -- Github codeblocks can now contain back ticks

Titus 13 år sedan
förälder
incheckning
f3f928084e
3 ändrade filer med 3 tillägg och 3 borttagningar
  1. 1 1
      src/showdown.js
  2. 1 1
      test/cases/github-style-codeblock.html
  3. 1 1
      test/cases/github-style-codeblock.md

+ 1 - 1
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;

+ 1 - 1
test/cases/github-style-codeblock.html

@@ -3,7 +3,7 @@
 <p>Define a function in javascript:</p>
 
 <pre><code>function MyFunc(a) {
-    // ...
+    var s = '`';
 }
 </code></pre>
 

+ 1 - 1
test/cases/github-style-codeblock.md

@@ -3,7 +3,7 @@ Define a function in javascript:
 
 ```
 function MyFunc(a) {
-    // ...
+    var s = '`';
 }
 ```