add option: headerRegex

This commit is contained in:
Julien Bisconti 2016-12-30 16:53:13 +02:00 committed by GitHub
parent 43ff0b643e
commit e2be2d7d27

View File

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