diff --git a/lib/jsdoc/util/templateHelper.js b/lib/jsdoc/util/templateHelper.js index 19097109..87544a90 100644 --- a/lib/jsdoc/util/templateHelper.js +++ b/lib/jsdoc/util/templateHelper.js @@ -505,7 +505,7 @@ var toTutorial = exports.toTutorial = function(tutorial, content, missingOpts) { /** Find symbol {@link ...} and {@tutorial ...} strings in text and turn into html links */ exports.resolveLinks = function(str) { - str = str.replace(/(?:\[(.+?)\])?\{@link(plain|code)? +(.+?)\}/gi, + str = str.replace(/(?:\[(.+?)\])?\{@link(plain|code)?\s+(.+?)\}/gi, function(match, content, monospace, longname) { if (monospace === 'plain') { monospace = false; diff --git a/test/specs/jsdoc/util/templateHelper.js b/test/specs/jsdoc/util/templateHelper.js index ed074b68..7d7b22fb 100644 --- a/test/specs/jsdoc/util/templateHelper.js +++ b/test/specs/jsdoc/util/templateHelper.js @@ -1106,6 +1106,20 @@ describe("jsdoc/util/templateHelper", function() { expect(output).toBe('Link to constructor'); }); + it('should allow linebreaks between link tag and content', function() { + var input = 'This is a {@link\ntest}.', + output = helper.resolveLinks(input); + + expect(output).toBe('This is a test.'); + }); + + it('should allow tabs between link tag and content', function() { + var input = 'This is a {@link\ttest}.', + output = helper.resolveLinks(input); + + expect(output).toBe('This is a test.'); + }); + // conf.monospaceLinks. check that // a) it works it('if conf.monospaceLinks is true, all {@link} should be monospace', function () {