mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
added ids to headings
This commit is contained in:
parent
1d4245852b
commit
3d3207142f
|
@ -688,7 +688,8 @@ var _DoHeaders = function(text) {
|
||||||
text = text.replace(/^(\#{1,6})[ \t]*(.+?)[ \t]*\#*\n+/gm,
|
text = text.replace(/^(\#{1,6})[ \t]*(.+?)[ \t]*\#*\n+/gm,
|
||||||
function(wholeMatch,m1,m2) {
|
function(wholeMatch,m1,m2) {
|
||||||
var h_level = m1.length;
|
var h_level = m1.length;
|
||||||
return hashBlock("<h" + h_level + ">" + _RunSpanGamut(m2) + "</h" + h_level + ">");
|
var id = m2.replace(/[^\w]/g, '').toLowerCase();
|
||||||
|
return hashBlock("<h" + h_level + ' id="' + id + '">' + _RunSpanGamut(m2) + "</h" + h_level + ">");
|
||||||
});
|
});
|
||||||
|
|
||||||
return text;
|
return text;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user