jsdoc3/jsdoc — pull request #293 by mathematicalcoffee (2012-12-28 14:16:47+00:00)
Title: Bugfix: github-flavoured-markdown was ignoring the hardwrap configuration.

The [readme for the jsdoc markdown plugin](usejsdoc.org/plugins-markdown.html) mentions a configuration option `conf.markdown.hardwrap` for the gfm parser, false by default, that determines whether newlines in comments are turned into `
`.

It doesn't work, because [in `showdown.js`](https://github.com/mathematicalcoffee/jsdoc/pull/new/bugfix-gfm-hardwrap#L1L154) the `hardwrap` option is queried from `this.hardwrap`, whereas in [`lib//jsdoc/util/markdown.js`'s `getParser` function](https://github.com/mathematicalcoffee/jsdoc/pull/new/bugfix-gfm-hardwrap#L0L62) we set

parser.hardwrap = !!env.conf.hardwrap;

where `parser` is really the result of `require('github-flavured-markdown')`, not the parser referred to by `this` in `showdown.js`.

## Fixes

The first commit fixes the hardwrap problem by querying the `hardwrap` configuration from `exports.hardwrap` (which is `parser.hardwrap`) rather than `this.hardwrap` (which can't be reached from outside the gfm module). It also adds a couple of tests for the hardwrap option.

The second commit is unrelated to the first but just adds in extra tests for the markdown parser, verifying that when one requests a particular parser, one gets it, and also testing the gfm `githubRepo{Name, Owner}` functionality (I just filled out the empty tests for `getParser`).

Although the second commit is unrelated to the first, I added it in this pull request purely because the tests make use of a convenience function used in the first commit (the [`setMarkdownConf` and `restoreMarkdownConf` functions](https://github.com/mathematicalcoffee/jsdoc/pull/new/bugfix-gfm-hardwrap#L2R16)).