Skip to content
Browse files

Fixed regex to work with multiple pieces of fenced code on a page

  • Loading branch information...
1 parent 1541ee0 commit 3f8609bcf7d6395d520e4874b827acf3b4686dc8 @OscarGodson committed Dec 5, 2011
Showing with 1 addition and 1 deletion.
  1. +1 −1 scripts/showdown.js
View
2 scripts/showdown.js
@@ -992,7 +992,7 @@ var _DoCodeBlocks = function(text) {
// and {code} is your code
//
var _DoCodeFencing = function(text) {
- text = text.replace(/`{3}(?:(.*$)\n)?([\s\S]*)`{3}/m,
+ text = text.replace(/`{3}(?:(.*$)\n)?([\s\S]*?)`{3}/gm,
function(wholeMatch,m1,m2){
//HTML for this is copied from GitHub directly for compatibility, except the lang="" attribute
var codeblock = '<div class="highlight"><pre lang="'+m1+'">'+m2+'</pre></div>';

0 comments on commit 3f8609b

Please sign in to comment.
Something went wrong with that request. Please try again.