Add heading id links
This commit is contained in:
12
js/heading-links.js
Normal file
12
js/heading-links.js
Normal file
@ -0,0 +1,12 @@
|
||||
(function() {
|
||||
var els = document.querySelectorAll('.post-content [id]');
|
||||
var headings = Array.prototype.slice.call(els);
|
||||
|
||||
headings.forEach(function(head) {
|
||||
var link = document.createElement('a');
|
||||
link.className = 'heading-link';
|
||||
link.href = '#' + head.id;
|
||||
|
||||
head.appendChild(link);
|
||||
});
|
||||
}());
|
Reference in New Issue
Block a user