|
@@ -15,17 +15,15 @@ showdown.subParser('headers', function (text, options, globals) {
|
|
// --------
|
|
// --------
|
|
//
|
|
//
|
|
text = text.replace(/^(.+)[ \t]*\n=+[ \t]*\n+/gm, function (wholeMatch, m1) {
|
|
text = text.replace(/^(.+)[ \t]*\n=+[ \t]*\n+/gm, function (wholeMatch, m1) {
|
|
- return showdown.subParser('hashBlock')('<h1 id="' + headerId(m1) + '">' + showdown.subParser('spanGamut')(m1,
|
|
|
|
- options,
|
|
|
|
- globals) + '</h1>',
|
|
|
|
- options, globals);
|
|
|
|
|
|
+ var spanGamut = showdown.subParser('spanGamut')(m1, options, globals),
|
|
|
|
+ hashBlock = '<h1 id="' + headerId(m1) + '">' + spanGamut + '</h1>';
|
|
|
|
+ return showdown.subParser('hashBlock')(hashBlock, options, globals);
|
|
});
|
|
});
|
|
|
|
|
|
text = text.replace(/^(.+)[ \t]*\n-+[ \t]*\n+/gm, function (matchFound, m1) {
|
|
text = text.replace(/^(.+)[ \t]*\n-+[ \t]*\n+/gm, function (matchFound, m1) {
|
|
- return showdown.subParser('hashBlock')('<h2 id="' + headerId(m1) + '">' + showdown.subParser('spanGamut')(m1,
|
|
|
|
- options,
|
|
|
|
- globals) + '</h2>',
|
|
|
|
- options, globals);
|
|
|
|
|
|
+ var spanGamut = showdown.subParser('spanGamut')(m1, options, globals),
|
|
|
|
+ hashBlock = '<h2 id="' + headerId(m1) + '">' + spanGamut + '</h2>';
|
|
|
|
+ return showdown.subParser('hashBlock')(hashBlock, options, globals);
|
|
});
|
|
});
|
|
|
|
|
|
// atx-style headers:
|
|
// atx-style headers:
|
|
@@ -48,8 +46,8 @@ showdown.subParser('headers', function (text, options, globals) {
|
|
*/
|
|
*/
|
|
|
|
|
|
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), header = '<h' + m1.length + ' id="' + headerId(m2) + '">' + span + '</h' + m1.length + '>';
|
|
|
|
|
|
+ var span = showdown.subParser('spanGamut')(m2, options, globals),
|
|
|
|
+ header = '<h' + m1.length + ' id="' + headerId(m2) + '">' + span + '</h' + m1.length + '>';
|
|
|
|
|
|
return showdown.subParser('hashBlock')(header, options, globals);
|
|
return showdown.subParser('hashBlock')(header, options, globals);
|
|
});
|
|
});
|