Options to configure headers ID convertion

This commit is contained in:
Julien Bisconti 2016-12-30 17:24:17 +02:00
parent e2be2d7d27
commit 5b6cb068a2
5 changed files with 4 additions and 2 deletions

BIN
dist/showdown.js vendored

Binary file not shown.

BIN
dist/showdown.js.map vendored

Binary file not shown.

BIN
dist/showdown.min.js vendored

Binary file not shown.

Binary file not shown.

View File

@ -52,8 +52,10 @@ showdown.subParser('headers', function (text, options, globals) {
}); });
function headerId(m) { function headerId(m) {
var regex = option.headerRegex || /[^\w]/g; var regex = options.headerRegex || /[^\w]/g,
var title, escapedId = m.replace(regex, '').toLowerCase(); replace = options.headerReplace || '',
title,
escapedId = m.replace(regex, replace).toLowerCase();
if (globals.hashLinkCounts[escapedId]) { if (globals.hashLinkCounts[escapedId]) {
title = escapedId + '-' + (globals.hashLinkCounts[escapedId]++); title = escapedId + '-' + (globals.hashLinkCounts[escapedId]++);