Spaces:
Configuration error
Configuration error
Download docs/scripts/tableOfContent.js from bisalsaha/lebel-studio: direct link, hf CLI and curl.
- Browser
- Download file 593 Bytes
-
https://huggingface.co/spaces/bisalsaha/lebel-studio/resolve/main/docs/scripts/tableOfContent.js
- Command line
-
hf download hf://spaces/bisalsaha/lebel-studio/docs/scripts/tableOfContent.js
-
curl -L -o tableOfContent.js https://huggingface.co/spaces/bisalsaha/lebel-studio/resolve/main/docs/scripts/tableOfContent.js
593 Bytes
| const { tocObj } = require('hexo-util'); | |
| module.exports = function () { | |
| return function tableOfContent(str, options = {}) { | |
| options = Object.assign({ | |
| min_depth: 1, | |
| max_depth: 6, | |
| }, options); | |
| const data = tocObj(str, { min_depth: options.min_depth, max_depth: options.max_depth }); | |
| if (!data.length) return ''; | |
| let html = ''; | |
| data.forEach(item => { | |
| html += `<li class="toc-list-level-${item.level}"><a href="#${item.id}">${item.text}</a></li>` | |
| }); | |
| return `<ol class="toc-list">${html}</ol>`; | |
| }; | |
| }; | |