allow GFM hardwrapping to be disabled

Note that hardwrapping is enabled by default in the GFM script (to preserve its behavior), but that it is disabled by default in the JSDoc plugin, as that seems more useful for inline documentation.
This commit is contained in:
Ben Blank 2012-04-20 14:54:33 -07:00
parent 8279f908d4
commit 660338e93b
2 changed files with 8 additions and 1 deletions

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

@ -101,6 +101,8 @@ var g_html_blocks;
// (see _ProcessListItems() for details):
var g_list_level = 0;
// == CJS == Allow hardwrapping to be disabled.
var g_hardwrap;
this.makeHtml = function(text) {
//
@ -118,6 +120,9 @@ this.makeHtml = function(text) {
g_titles = new Array();
g_html_blocks = new Array();
// == CJS == Allow hardwrapping to be disabled.
g_hardwrap = typeof this.hardwrap === "undefined" || this.hardwrap;
// attacklab: Replace ~ with ~T
// This lets us use tilde as an escape char to avoid md5 hashes
// The choice of character is arbitray; anything that isn't
@ -1140,7 +1145,8 @@ var _FormParagraphs = function(text) {
}
else if (str.search(/\S/) >= 0) {
str = _RunSpanGamut(str);
str = str.replace(/\n/g,"<br />"); // ** GFM **
// == CJS == Allow hardwrapping to be disabled.
if (g_hardwrap) str = str.replace(/\n/g,"<br />"); // ** GFM **
str = str.replace(/^([ \t]*)/g,"<p>");
str += "</p>"
grafsOut.push(str);

View File

@ -28,6 +28,7 @@ function getParser(parser, conf) {
parser = new (require("gfm/showdown").Converter)();
parser.githubRepoOwner = conf.githubRepoOwner;
parser.githubRepoName = conf.githubRepoName;
parser.hardwrap = !!conf.gfmHardwrap;
return function(source) {
return parser.makeHtml(source);