hexo-auto-toc
Automatically generates a responsive table of contents that fixes to the side of the article page or above the articles, depending on the user's device.
Automatically generates a responsive table of contents that fixes to the side of the article page or above the articles, depending on the user's device. It can also automatically choose to be on the left or on the right.
- Requirement 必须具备
npm install cheerio --save
- Getting Started
- Installation
npm install hexo-auto-toc
- The plugin will automatically parse all content within the
<article>
tag and generate a table of contents. If your article page structure does not wrap the content inside an<article>
element, contents in<body>
will be parsed. Or you can add<article>
manually — typically in theindex.html
file under yourblog
folder, but this is not necessary. - check the effects:
hexo clean&&hexo g&&hexo s
- 使用
- 安装
npm install hexo-auto-toc
- 插件会自动对
<article>
包含下的所有内容进行解析,自动生成目录。如果你的文章页面结构中内容没被<article>
包裹,将会解析<body>
下的所有内容;你可以自行添加<article>
(即blog文件夹下的index.html),但不是必须的。 - 查看效果
hexo clean&&hexo g&&hexo s
- 效果 Example
- 更新
6.17
更普适多种主题
优化正则表达式匹配
加入cheerio解析html 避免正则表达式弊端
优化toc模块位置,如果有nav则放在nav标签下方
优化toc放置左/右,自动选择放在哪边
-
New Updates
-
version 1.0.6
Except index page, other pages have TOC if they have kinds of headers.
-
version 1.0.5
Greater compatibility: Works with a wider variety of themes.
Performance Boost: Optimized the regular expressions for better matching.
Reliable Parsing: Integrated the Cheerio library to parse HTML, avoiding the drawbacks and errors common with regular expressions.
Smarter Positioning: Improved the Table of Contents (TOC) module's location; it will now be placed directly after the element if one is present.
Automatic Layout: Enhanced the left/right placement of the TOC, allowing it to automatically choose the best side.
-
- hexo-everyday-calendar:This is a practical calendar plugin for hexo bloggers, like contribution statistics on GitHub.