From 9a0492a7acbac9fd943bd78b75d02bb167755f3d Mon Sep 17 00:00:00 2001 From: Titus Date: Thu, 14 Jun 2012 00:02:14 -0600 Subject: [PATCH] Fixed #20 -- Github style codeblocks can now start the parsed string --- src/showdown.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/showdown.js b/src/showdown.js index de07e38..061b861 100644 --- a/src/showdown.js +++ b/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;