Make the markdown parser able to generate anchors for headings

It uses the following configuration key in the markdown
section : idInHeadings.
If set to true it will make the headings generated in the markdown have
id's like on github.
This commit is contained in:
Alexandre Stanislawski 2015-06-26 17:15:53 +02:00
parent 7a0ec07521
commit aecd558f1c

View File

@ -104,9 +104,11 @@ function getParseFunction(parserName, conf) {
// Marked generates an "id" attribute for headers; this custom renderer suppresses it
markedRenderer = new marked.Renderer();
markedRenderer.heading = function(text, level) {
return util.format('<h%s>%s</h%s>', level, text, level);
};
if(!conf.idInHeadings) {
markedRenderer.heading = function(text, level) {
return util.format('<h%s>%s</h%s>', level, text, level);
};
}
// Allow prettyprint to work on inline code samples
markedRenderer.code = function(code, language) {