All Projects → KELEN → Katelog

KELEN / Katelog

文章目录生成器

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Katelog

Kotlin Tutorials
【Kotlin 视频教程】国内资料较少,我录制了一套视频作为抛砖引玉~
Stars: ✭ 14 (-68.18%)
Mutual labels:  article
Simorgh
The BBC's Open Source Single Page Application. Contributions welcome! Used on some of our biggest websites, e.g.
Stars: ✭ 550 (+1150%)
Mutual labels:  article
Weixin Platform History Article Api
微信公众号历史文章爬取api
Stars: ✭ 27 (-38.64%)
Mutual labels:  article
Clean Mark
Convert an article into a clean text
Stars: ✭ 414 (+840.91%)
Mutual labels:  article
Fullstack React
A simple, full-stack JavaScript single page app featuring React, Webpack, and Falcor
Stars: ✭ 503 (+1043.18%)
Mutual labels:  article
Blog
blog of sivagao,每天一篇好文章~
Stars: ✭ 616 (+1300%)
Mutual labels:  article
Awesome Django Admin
Curated List of Awesome Django Admin Panel Articles, Libraries/Packages, Books, Themes, Videos, Resources.
Stars: ✭ 356 (+709.09%)
Mutual labels:  article
Pushclient
A cross-platform method of using Firebase Cloud Messaging (FCM) to receive push notifications
Stars: ✭ 33 (-25%)
Mutual labels:  article
Es6 Articles
Blog Posts from Wes Bos. If you make an edit to one of these posts, my blog will automatically update.
Stars: ✭ 527 (+1097.73%)
Mutual labels:  article
Dataset Artikel
Repository ini berisikan kumpulan data mentah berupa artikel dari berbagai media online di Indonesia. (Raw dataset of Indonesian news articles)
Stars: ✭ 26 (-40.91%)
Mutual labels:  article
Go Clean Arch
Go (Golang) Clean Architecture based on Reading Uncle Bob's Clean Architecture
Stars: ✭ 5,128 (+11554.55%)
Mutual labels:  article
Flingos
An educational operating system written in C#. A great stepping stone from high to low level development.
Stars: ✭ 451 (+925%)
Mutual labels:  article
History Of Javascript
Project "History of JavaScript"
Stars: ✭ 819 (+1761.36%)
Mutual labels:  article
Php Goose
Readability / Html Content / Article Extractor & Web Scrapping library written in PHP
Stars: ✭ 392 (+790.91%)
Mutual labels:  article
Tns Restful Json Api
This is the code repository that goes along with the "TheNewStack" article for RESTful JSON API post
Stars: ✭ 846 (+1822.73%)
Mutual labels:  article
Epub Press Clients
📦 Clients for building books with EpubPress.
Stars: ✭ 370 (+740.91%)
Mutual labels:  article
Articles Translator
📚Translate the distinct technical blogs. Please star or watch. Welcome to join me.
Stars: ✭ 606 (+1277.27%)
Mutual labels:  article
Analyze
Draven's Blog
Stars: ✭ 7,910 (+17877.27%)
Mutual labels:  article
Documents
Documentation for Phase 4 Ground
Stars: ✭ 31 (-29.55%)
Mutual labels:  article
Rticles
LaTeX Journal Article Templates for R Markdown
Stars: ✭ 895 (+1934.09%)
Mutual labels:  article

文章目录自动生成器

类似于segmentfault和掘金的文章目录,无第三方依赖的,自动生成文章目录结构,灵活配置

demo地址

npm引入

npm i katelog -S

es6使用

import katelog from 'katelog';
console.log(katelog);

html引入

<!-- 引入js文件 -->
<script src='./katelog.min.js'></script>
<!-- 文章容器 -->
<div id="kCatelog"></div>
<!-- 目录容器 -->
<div class="k-catelog-list" id="catelogList"></div>
new katelog({
    contentEl: 'kCatelog',
    catelogEl: 'catelogList',
    linkClass: 'k-catelog-link',
    linkActiveClass: 'k-catelog-link-active',
    supplyTop: 20,
    selector: ['h2', 'h3'],
    active: function (el) {
        console.log(el);
    }
});

仅支持IE8以上和主流的浏览器

选项

contentEl

文章容器,id选择器

catelogEl

目录容器,id选择器

linkClass

每个目录项的类

linkActiveClass

当前激活的目录项的类

selector(可选)

选择目录的标题元素,默认支持6级树形结构

默认值: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']

selector: ['h2', 'h3']
supplyTop(可选)

每个目录需要补充的高度,比如fixed头部布局会挡住实现,可以设置supplyTop来修正

方法

rebuild()

动态新增或者删除的内容,重新构建目录

let katelog = new katelog({ ... });
katelog.rebuild();
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].