Skip to content

Commit

Permalink
update Marked; suppress IDs in headings (jsdoc#582)
Browse files Browse the repository at this point in the history
  • Loading branch information
hegemonic committed Feb 15, 2014
1 parent 98d646a commit d51faa1
Show file tree
Hide file tree
Showing 5 changed files with 349 additions and 161 deletions.
12 changes: 11 additions & 1 deletion lib/jsdoc/util/markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,28 @@ function unescapeUrls(source) {
function getParseFunction(parserName, conf) {
var logger = require('jsdoc/util/logger');
var marked = require('marked');

var markedRenderer;
var parserFunction;

conf = conf || {};

if (parserName === parserNames.marked) {
// Marked generates an "id" attribute for headers; this custom renderer suppresses it
markedRenderer = new marked.Renderer();
markedRenderer.heading = function(text, level) {
var util = require('util');

return util.format('<h%s>%s</h%s>', level, text, level);
};

parserFunction = function(source) {
var result;

source = escapeUnderscores(source);
source = escapeUrls(source);

result = marked(source)
result = marked(source, { renderer: markedRenderer })
.replace(/\s+$/, '')
.replace(/&#39;/g, "'");
result = unescapeUrls(result);
Expand Down
2 changes: 1 addition & 1 deletion node_modules/marked/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d51faa1

Please sign in to comment.