mirror of
https://github.com/danpros/htmly.git
synced 2026-04-18 19:46:21 +05:30
Update toc.js
This commit is contained in:
parent
a219be2621
commit
0fbbf781c5
1 changed files with 1 additions and 1 deletions
|
|
@ -28,7 +28,7 @@
|
||||||
function htmlTableOfContents (id) {
|
function htmlTableOfContents (id) {
|
||||||
var documentRef = document;
|
var documentRef = document;
|
||||||
var toc = documentRef.getElementById('toc');
|
var toc = documentRef.getElementById('toc');
|
||||||
var headings = [].slice.call(documentRef.body.querySelectorAll('#content h1, #content h2, #content h3, #content h4, #content h5, #content h6'));
|
var headings = [].slice.call(documentRef.body.querySelectorAll('#content h2, #content h3, #content h4, #content h5, #content h6'));
|
||||||
headings.forEach(function (heading, index) {
|
headings.forEach(function (heading, index) {
|
||||||
heading.setAttribute('id', heading.textContent.replace(/\s+/g, '-').toLowerCase() + id);
|
heading.setAttribute('id', heading.textContent.replace(/\s+/g, '-').toLowerCase() + id);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue