mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
Markdown Input EOL Filtering
Added filters for input end of line character where evilstreak/markdown was called because it chokes on `\r\n`. We'll have to do this to any input to this markdown parser unless/until they accept my pull request and we update the upstream source. https://github.com/evilstreak/markdown-js/pull/64
This commit is contained in:
parent
409c62b22c
commit
e36cb0f96b
@ -50,6 +50,8 @@ function getParser(parser, conf) {
|
||||
parser = require(parser).markdown;
|
||||
|
||||
return function(source) {
|
||||
// filters EOL of source so evilstreak/markdown doesn't screw the pooch.
|
||||
source = source.replace(/(\r\n|\n|\r)/g, '\n');
|
||||
return parser.toHTML(source, conf.dialect);
|
||||
};
|
||||
} else {
|
||||
|
||||
@ -32,6 +32,8 @@ function getParser(parser, conf) {
|
||||
parser = require('markdown').markdown;
|
||||
|
||||
return function(source) {
|
||||
// filters EOL of source so evilstreak/markdown doesn't screw the pooch.
|
||||
source = source.replace(/(\r\n|\n|\r)/g, '\n');
|
||||
return parser.toHTML(source, conf.dialect);
|
||||
};
|
||||
}
|
||||
|
||||
@ -68,6 +68,8 @@ exports.Tutorial.prototype.parse = function() {
|
||||
|
||||
// markdown
|
||||
case exports.TYPES.MARKDOWN:
|
||||
// filters EOL of source so evilstreak/markdown doesn't screw the pooch.
|
||||
this.content = this.content.replace(/(\r\n|\n|\r)/g, '\n');
|
||||
return mdParser.toHTML(this.content)
|
||||
.replace(/&/g, '&') // because markdown escapes these
|
||||
.replace(/</g, '<')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user