/** * Modified from JSDoc's plugins/markdown and lib/jsdoc/util/markdown modules * (see https://github.com/jsdoc3/jsdoc/), which are licensed under the Apache 2 * license (see https://www.apache.org/licenses/LICENSE-2.0). * * This version does not protect http(s) urls from being turned into links, and * works around an issue with `~` characters in module paths by escaping them. */ const marked = require('marked'); const format = require('util').format; const tags = [ 'author', 'classdesc', 'description', 'exceptions', 'params', 'properties', 'returns', 'see', 'summary', ]; const hasOwnProp = Object.prototype.hasOwnProperty; const markedRenderer = new marked.Renderer(); // Allow prettyprint to work on inline code samples markedRenderer.code = function (code, language) { const langClass = language ? ' lang-' + language : ''; return format( '
%s
', langClass, escapeCode(code) ); }; function escapeCode(source) { return source .replace(/