mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
fix(subParsers/headers); fix bug introduced with noHeaderId option
This commit is contained in:
parent
7ac893e93b
commit
3a71b66d24
|
@ -13,14 +13,14 @@ showdown.subParser('headers', function (text, options, globals) {
|
|||
text = text.replace(/^(.+)[ \t]*\n=+[ \t]*\n+/gm, function (wholeMatch, m1) {
|
||||
|
||||
var spanGamut = showdown.subParser('spanGamut')(m1, options, globals),
|
||||
hID = (options.noHeaderId) ? '' : 'id="' + headerId(m1) + '"',
|
||||
hID = (options.noHeaderId) ? '' : ' id="' + headerId(m1) + '"',
|
||||
hashBlock = '<h1' + hID + '>' + spanGamut + '</h1>';
|
||||
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) + '"',
|
||||
hID = (options.noHeaderId) ? '' : ' id="' + headerId(m1) + '"',
|
||||
hashBlock = '<h2' + hID + '>' + spanGamut + '</h2>';
|
||||
return showdown.subParser('hashBlock')(hashBlock, options, globals);
|
||||
});
|
||||
|
@ -44,9 +44,9 @@ showdown.subParser('headers', function (text, options, globals) {
|
|||
/gm, function() {...});
|
||||
*/
|
||||
|
||||
text = text.replace(/^(\#{1,6})[ \t]*(.+?)[ \t]*\#*\n+/gm, function (wholeMatch, m1, m2) {
|
||||
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(m1) + '"',
|
||||
hID = (options.noHeaderId) ? '' : ' id="' + headerId(m2) + '"',
|
||||
header = '<h' + m1.length + hID + '>' + span + '</h' + m1.length + '>';
|
||||
|
||||
return showdown.subParser('hashBlock')(header, options, globals);
|
||||
|
|
Loading…
Reference in New Issue
Block a user