|
@@ -12,6 +12,7 @@ var showdown = {},
|
|
|
omitExtraWLInCodeBlocks: false,
|
|
|
prefixHeaderId: false,
|
|
|
noHeaderId: false,
|
|
|
+ headerLevelStart: 1,
|
|
|
parseImgDimensions: false
|
|
|
},
|
|
|
globalOptions = JSON.parse(JSON.stringify(defaultOptions)); //clone default options out of laziness =P
|
|
@@ -1456,14 +1457,16 @@ showdown.subParser('headers', function (text, options, globals) {
|
|
|
|
|
|
var spanGamut = showdown.subParser('spanGamut')(m1, options, globals),
|
|
|
hID = (options.noHeaderId) ? '' : ' id="' + headerId(m1) + '"',
|
|
|
- hashBlock = '<h1' + hID + '>' + spanGamut + '</h1>';
|
|
|
+ hLevel = parseInt(options.headerLevelStart),
|
|
|
+ hashBlock = '<h' + hLevel + hID + '>' + spanGamut + '</h' + hLevel + '>';
|
|
|
return showdown.subParser('hashBlock')(hashBlock, options, globals);
|
|
|
});
|
|
|
|
|
|
text = text.replace(/^(.+)[ \t]*\n-+[ \t]*\n+/gm, function (matchFound, m1) {
|
|
|
var spanGamut = showdown.subParser('spanGamut')(m1, options, globals),
|
|
|
hID = (options.noHeaderId) ? '' : ' id="' + headerId(m1) + '"',
|
|
|
- hashBlock = '<h2' + hID + '>' + spanGamut + '</h2>';
|
|
|
+ hLevel = parseInt(options.headerLevelStart) + 1,
|
|
|
+ hashBlock = '<h' + hLevel + hID + '>' + spanGamut + '</h' + hLevel + '>';
|
|
|
return showdown.subParser('hashBlock')(hashBlock, options, globals);
|
|
|
});
|
|
|
|
|
@@ -1489,7 +1492,8 @@ showdown.subParser('headers', function (text, options, globals) {
|
|
|
text = text.replace(/^(#{1,6})[ \t]*(.+?)[ \t]*#*\n+/gm, function (wholeMatch, m1, m2) {
|
|
|
var span = showdown.subParser('spanGamut')(m2, options, globals),
|
|
|
hID = (options.noHeaderId) ? '' : ' id="' + headerId(m2) + '"',
|
|
|
- header = '<h' + m1.length + hID + '>' + span + '</h' + m1.length + '>';
|
|
|
+ hLevel = parseInt(options.headerLevelStart) - 1 + m1.length,
|
|
|
+ header = '<h' + hLevel + hID + '>' + span + '</h' + hLevel + '>';
|
|
|
|
|
|
return showdown.subParser('hashBlock')(header, options, globals);
|
|
|
});
|