Add support for a markdown.hardwrap config property

This commit is contained in:
Dasa Paddock 2015-03-25 16:54:34 -07:00
parent da14fedb69
commit 36717281ac
2 changed files with 12 additions and 0 deletions

View File

@ -97,6 +97,10 @@ function getParseFunction(parserName, conf) {
conf = conf || {};
if (parserName === parserNames.marked) {
if (conf.hardwrap) {
marked.setOptions({breaks: true});
}
// Marked generates an "id" attribute for headers; this custom renderer suppresses it
markedRenderer = new marked.Renderer();

View File

@ -97,5 +97,13 @@ describe('jsdoc/util/markdown', function() {
expect(parser(markdownText)).toBe(convertedText);
});
it('should hardwrap new lines when hardwrap is enabled', function() {
var storage = setMarkdownConf({hardwrap: true});
var parser = markdown.getParser();
expect(parser('line one\nline two')).toEqual(
'<p>line one<br>line two</p>');
});
});
});