diff --git a/dist/showdown.js b/dist/showdown.js index a3a24da..e4240a3 100644 Binary files a/dist/showdown.js and b/dist/showdown.js differ diff --git a/dist/showdown.js.map b/dist/showdown.js.map index 2e24154..483b81d 100644 Binary files a/dist/showdown.js.map and b/dist/showdown.js.map differ diff --git a/dist/showdown.min.js b/dist/showdown.min.js index 230391b..2a4788f 100644 Binary files a/dist/showdown.min.js and b/dist/showdown.min.js differ diff --git a/dist/showdown.min.js.map b/dist/showdown.min.js.map index 13fc3d5..7a42788 100644 Binary files a/dist/showdown.min.js.map and b/dist/showdown.min.js.map differ diff --git a/src/showdown.js b/src/showdown.js index db816d3..b3e6269 100644 --- a/src/showdown.js +++ b/src/showdown.js @@ -16,7 +16,8 @@ var showdown = {}, literalMidWordUnderscores: false, strikethrough: false, tables: false, - tablesHeaderId: false + tablesHeaderId: false, + ghCodeBlocks: true // true due to historical reasons }, globalOptions = JSON.parse(JSON.stringify(defaultOptions)); //clone default options out of laziness =P diff --git a/src/subParsers/githubCodeBlocks.js b/src/subParsers/githubCodeBlocks.js index c59a2b0..149849a 100644 --- a/src/subParsers/githubCodeBlocks.js +++ b/src/subParsers/githubCodeBlocks.js @@ -11,6 +11,11 @@ showdown.subParser('githubCodeBlocks', function (text, options, globals) { 'use strict'; + // early exit if option is not enabled + if (!options.ghCodeBlocks) { + return text; + } + text += '~0'; text = text.replace(/(?:^|\n)```(.*)\n([\s\S]*?)\n```/g, function (wholeMatch, m1, m2) { diff --git a/test/features/disable_gh_codeblocks.html b/test/features/disable_gh_codeblocks.html new file mode 100644 index 0000000..35dc1c2 --- /dev/null +++ b/test/features/disable_gh_codeblocks.html @@ -0,0 +1,9 @@ +

this is some text

+ +

php +function thisThing() { +echo "some weird formatted code!"; +} +

+ +

some other text

diff --git a/test/features/disable_gh_codeblocks.md b/test/features/disable_gh_codeblocks.md new file mode 100644 index 0000000..8d307ff --- /dev/null +++ b/test/features/disable_gh_codeblocks.md @@ -0,0 +1,9 @@ +this is some text + +```php +function thisThing() { + echo "some weird formatted code!"; +} +``` + +some other text \ No newline at end of file diff --git a/test/node/showdown.js b/test/node/showdown.js index bc65a30..e72849b 100644 --- a/test/node/showdown.js +++ b/test/node/showdown.js @@ -27,7 +27,8 @@ describe('showdown.options', function () { literalMidWordUnderscores: false, strikethrough: false, tables: false, - tablesHeaderId: false + tablesHeaderId: false, + ghCodeBlocks: true }; expect(showdown.getDefaultOptions()).to.be.eql(opts); }); diff --git a/test/node/testsuite.features.js b/test/node/testsuite.features.js index 8de4923..e6d60de 100644 --- a/test/node/testsuite.features.js +++ b/test/node/testsuite.features.js @@ -21,6 +21,8 @@ describe('makeHtml() features testsuite', function () { converter = new showdown.Converter({literalMidWordUnderscores: true}); } else if (testsuite[i].name === '#164.3.strikethrough') { converter = new showdown.Converter({strikethrough: true}); + } else if (testsuite[i].name === 'disable_gh_codeblocks') { + converter = new showdown.Converter({ghCodeBlocks: false}); } else { converter = new showdown.Converter(); }