Skip to content

Commit

Permalink
Merge pull request jsdoc#966 from dasa/hardwrap-markdown
Browse files Browse the repository at this point in the history
Add support for a `markdown.hardwrap` config property
  • Loading branch information
hegemonic committed Mar 29, 2015
2 parents f9764ed + 3671728 commit 3c1f043
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/jsdoc/util/markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
8 changes: 8 additions & 0 deletions test/specs/jsdoc/util/markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -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>');
});
});
});

0 comments on commit 3c1f043

Please sign in to comment.