diff --git a/lib/jsdoc/util/markdown.js b/lib/jsdoc/util/markdown.js index 2708bbd8..37965ef8 100644 --- a/lib/jsdoc/util/markdown.js +++ b/lib/jsdoc/util/markdown.js @@ -77,6 +77,20 @@ function escapeCode(source) { .replace(/'/g, '''); } +/** + * Unencode quotes that occur within {@ ... } after the markdown parser has turned them + * into html entities (unfortunately it isn't possible to escape them before parsing) + * + * @param {string} source - The source text to unencode. + * @return {string} The source text with html entity `"` converted back to standard quotes + */ +function unencodeQuotes(source) { + return source.replace(/\{@[^}\r\n]+\}/g, function (wholeMatch) { + return wholeMatch.replace(/"/g, '"'); + }); +} + + /** * Retrieve a function that accepts a single parameter containing Markdown source. The function uses * the specified parser to transform the Markdown source to HTML, then returns the HTML as a string. @@ -125,7 +139,9 @@ function getParseFunction(parserName, conf) { result = marked(source, { renderer: markedRenderer }) .replace(/\s+$/, '') .replace(/'/g, "'"); + result = unescapeUrls(result); + result = unencodeQuotes(result); return result; };