Browse Source

Fixed #20 -- Github style codeblocks can now start the parsed string

Titus 13 years ago
parent
commit
9a0492a7ac
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/showdown.js

+ 2 - 2
src/showdown.js

@@ -888,7 +888,7 @@ var _DoCodeBlocks = function(text) {
 	text = text.replace(/~0/,"");
 
 	return text;
-}
+};
 
 var _DoGithubCodeBlocks = function(text) {
 //
@@ -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([^`]+)\n```/g,
 		function(wholeMatch,m1,m2) {
 			var language = m1;
 			var codeblock = m2;