12345678910111213141516171819202122232425262728293031 |
- {{- if .Params.toc }}
- <script defer src="/tocbot/tocbot.min.js"></script>
- <script>
- function docReady(fn) {
- // see if DOM is already available
- if (document.readyState === "complete" || document.readyState === "interactive") {
- // call on next available tick
- setTimeout(fn, 1);
- } else {
- document.addEventListener("DOMContentLoaded", fn);
- }
- }
- docReady(function () {
- var head = document.getElementsByTagName("head")[0], script;
- // Load table of contents
- function initToc(fn) {
- window.tocbot.init({
- // Where to render the table of contents.
- tocSelector: '.js-toc',
- // Where to grab the headings to build the table of contents.
- contentSelector: '.js-toc-content',
- // Which headings to grab inside of the contentSelector element.
- headingSelector: 'h1, h2, h3'
- });
- }
- initToc();
- });
- </script>
- {{- end }}
|