add CommonJS module exports for Showdown and make its GFM extensions sandboxable

This commit is contained in:
Ben Blank 2012-04-19 16:46:36 -07:00
parent 0003041ad9
commit a49fc092fb

18
node_modules/gfm/showdown.js generated vendored
View File

@ -68,6 +68,13 @@
// Modifications are tagged with "GFM"
// **************************************************
// ==================================================
// CommonJS modifications by benblank
// http://www.commonjs.org/specs/modules/1.0/
//
// Modifications are tagged with "CJS"
// ==================================================
//
// Showdown namespace
//
@ -154,6 +161,12 @@ this.makeHtml = function(text) {
// attacklab: Restore tildes
text = text.replace(/~T/g,"~");
// == CJS == Create local `GitHub` object for use by GFM
var GitHub = this.githubRepoName && this.githubRepoOwner ? {
nameWithOwner: this.githubRepoOwner + "/" + this.githubRepoName,
repoName: this.githubRepoName
} : typeof window !== "undefined" ? window.GitHub : undefined;
// ** GFM ** Auto-link URLs and emails
text = text.replace(/https?\:\/\/[^"\s\<\>]*[^.,;'">\:\s\<\>\)\]\!]/g, function(wholeMatch,matchIndex){
var left = text.slice(0, matchIndex), right = text.slice(matchIndex)
@ -1359,4 +1372,7 @@ var escapeCharacters_callback = function(wholeMatch,m1) {
return "~E"+charCodeToEscape+"E";
}
} // end of Showdown.converter
} // end of Showdown.converter
// == CJS == Export the converter
if (typeof exports !== "undefined") exports.Converter = Showdown.converter;