This is the repo for a simple vanilla JavaScript table of contents generator. It parses through a document looking for headers and then builds a table of contents by either using existing IDs or creating them.
Folder | Files |
---|---|
dist/ | Compiled JavaScript, ready to use |
src/ | Original TypeScript files |
<head>
<script src="toc.js" type="text/javascript"></script>
<script>
window.addEventListener("load", function (event) {
makeList({
'target': '#toc', // Selector for element to place table of contents
'parent': 'article' // Selector for element to parse headers from (default: 'body')
});
});
</script>
</head>