同步操作将从 Yaohaixiao/outline.js 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
AnchorJS 是 AutocJS 的创作灵感。既然 AnchorJS 可创建标题的链接,为什么不直接给文章生成一个目录(Table of Contents)导航呢? 于是就有了 AutocJS。
AutocJS 是一个专门用来生成文章目录(Table of Contents)导航的工具。AutocJS 会查找文章指定区域中的所有 h1~h6 的标签,并自动分析文章的层次结构,生成文章的目录导航(独立的侧边栏菜单,或者在文章的开始处生成文章目录)。
AnchorJS 由于不是中国工程师开发的,所以对中文支持不好,无法给中文标题生成锚点。而 AutocJS 即支持英文也支持中文。AutocJS 在拥有 AnchorJS 的基础功能同时,还可以自动分析文章的层次结构,生成文章的目录导航。
npm install autocjs
bower install autocjs
var AutocJS = require('autocjs');
new AutocJS({
article: '#article'
});
$('#article').autoc({
title: 'AutocJS v0.2.0'
});
new AutocJS({
article: '#article',
title: 'AutocJS v0.2.0'
});
This task primarily delegates to AutocJS, so please consider the AutocJS documentation as required reading for advanced configuration.
Type: String
HTMLElement
Default: ''
必选,用来指定页面中显示文章正文的 DOM 节点或者 ID 选择器。如果没有指定它,则程序将不会执行。查看详情
Type: String
Default: 'h1,h2,h3,h4,h5,h6'
可选,用来指定 article 节点下,要生成导航的标题标签的选择器。查看详情
Type: String
Default: 'Table of Contents'
可选,用来指定 AutocJS 自动创建的文章导读索引导航菜单的标题文字。查看详情
Type: Boolean
Default: false
可选,用来指定是否只创建标题链接。查看详情
Type: Boolean
Default: true
可选,用来指定在点击段落索引导航链接时,是使用动画滚动定位,还是使用默认的锚点链接行为。查看详情
Type: Boolean
Default: false
可选,用来指定是否在文章(开始位置)中创建目录导航。查看详情
Type: Boolean
Default: false
可选,用来指定是否在文章标题中显示该标题的段落索引编号。查看详情
Type: Boolean
Default: true
可选,用来指定是否在导航菜单中显示段落索引编号。查看详情
Type: Objects
静态属性,存储的是 AutocJS 对象默认配置选项。查看详情
Type: String
存储的是 AutocJS 当前的版本号。查看详情
new AutocJS({
article: '#container',
// 只收集文章中的 h2 标题标签
selector: 'h2'
});
演示地址:http://yaohaixiao.github.io/AutocJS/examples/customize-selector.htm
new AutocJS({
article: '#container',
title: 'Customize Title'
});
演示地址:http://yaohaixiao.github.io/AutocJS/examples/customize-title.htm
new AutocJS({
article: '#container',
isAnchorsOnly: true
});
演示地址:http://yaohaixiao.github.io/AutocJS/examples/create-anchors-only.htm
new AutocJS({
article: '#container',
// 不配置 isAnimateScroll 或者设置为 true 则是默认的动画滚动定位
isAnimateScroll: false
});
演示地址:http://yaohaixiao.github.io/AutocJS/examples/positioning-behavior.htm
new AutocJS({
article: '#container',
// 不配置 hasDirectoryInArticle 或者设置为 false,则不会在文章开始位置显示目录导航
hasDirectoryInArticle: true,
// 通常这个时候就不需要侧边栏的导航菜单了,当然你也可以两个都要(isAnchorsOnly: false 即可)。
onlyAnchors: true
});
演示地址:http://yaohaixiao.github.io/AutocJS/examples/create-directory-navigation-in-the-article.htm
new AutocJS({
article: '#container',
// 不配置 hasCodeAtHeadings 或者设置为 false,则不会在文章中的标题上显示段落章节索引编码
hasCodeAtHeadings: true
});
演示地址:http://yaohaixiao.github.io/AutocJS/examples/has-chapter-code-at-the-headings.htm
See the CHANGELOG.
Code licensed under MIT License.
API Documentation licensed under CC BY 3.0.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。