assemble-plugin-toc
v0.0.4
Published
Assemble目录自动生成插件,生成html使用Cheerio.js.
Downloads
7
Maintainers
Readme
assemble-plugin-toc
Assemble目录自动生成插件,生成html使用Cheerio.js.
Table of Contents
Quickstart
包安装:
npm install assemble-plugin-toc --save
Gruntfile.js定制:
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
assemble: {
options: {
plugins: ['assemble-plugin-toc']
},
...
}
});
grunt.loadNpmTasks('assemble');
grunt.registerTask('default', ['assemble']);
};
Options
tocid
Type: String
Default: toc
增加html容器id,默认toc
listid
Type: String
定义列表id,默认toc-list
listclass
Type: String
定义列表的类,默认空
hclassprefix
Type: String
Default: toc-h
新生成列表标题class前缀,默认toc-h,然后toc-h1,toc-h2,toc-h3
hnameprefix
Type: String
Default: toc-name
描点name的前缀,默认toc-name,然后toc-name1,toc-name2,toc-name3
boxid
Type: String
要提取生成toc的容器id,默认是全局
Usage Examples
基本用法
最基本用法:
assemble: {
blog: {
options: {
plugins: ['assemble-plugin-toc'],
},
files: {
'./blog/': ['./templates/blog/*.hbs']
}
}
}
高级
assemble: {
blog: {
options: {
plugins: ['assemble-plugin-toc'],
toc: {
boxid: 'toc'
listid: 'toc-list'
listclass: 'listclass'
hclassprefix: 'toc-h'
hnameprefix: 'toc-name'
}
},
files: {
'./blog/': ['./templates/blog/*.hbs']
}
}
}
注意:要查看链接图标,一定要在服务器状态!
Author
GoldCome
- Github: https://github.com/GoldCome
- Blog:http://www.gdcome.com
- QQ/Email: [email protected]
Release History
- 2014-02-21 v0.0.0 重新构建目录生成插件
- 2014-02-21 v0.0.1 修正当标题存在其他html代码时无法正确获取属性问题
- 2014-02-22 v0.0.2 增加一个能提取指定id容器内容为toc的选项,并不总是全局,但默认是全局
- 2014-03-09 v0.0.3 发布到github
- 2014-03-13 v0.0.4 重新命名发布
License
Copyright (c) 2014 goldcome, contributors. Released under the MIT license
This file was generated on Saturday, March 15, 2014.