mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
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:
parent
8279f908d4
commit
660338e93b
8
node_modules/gfm/showdown.js
generated
vendored
8
node_modules/gfm/showdown.js
generated
vendored
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user