Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/qrac/minitoc
Generate a table of contents by searching for headings.
https://github.com/qrac/minitoc
javascript minitoc toc vanilla-js
Last synced: 29 days ago
JSON representation
Generate a table of contents by searching for headings.
- Host: GitHub
- URL: https://github.com/qrac/minitoc
- Owner: qrac
- License: mit
- Created: 2022-01-20T13:13:12.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-01-21T08:39:36.000Z (almost 3 years ago)
- Last Synced: 2024-11-13T02:19:44.129Z (about 1 month ago)
- Topics: javascript, minitoc, toc, vanilla-js
- Language: TypeScript
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# minitoc
見出しを検索して目次を生成するシンプルな JavaScript ライブラリ。
## How To Use
CDN を読み込み `minitoc.init()` で実行します。
```html
minitoc.init()
``````html
テストh2
テストh3
テスト文章テスト文章テスト文章テスト文章テスト文章テスト文章
...
```## Methods
| Method | Result |
| ---------------- | -------------------------- |
| `minitoc.init()` | 見出しを検索して目次を出力 |## Options
```js
// Example
minitoc.init({
tocSelector: "[data-toc]", // 目次を出力するセレクター
containerSelector: "[data-toc-container]", // 見出しを検索するセレクター
headingSelector: "h1, h2, h3", // 検索対象の見出し
})
```## Respect
- [jgallen23/toc: jQuery Table of Contents Plugin](https://github.com/jgallen23/toc)
- [tscanlin/tocbot: Build a table of contents from headings in an HTML document.](https://github.com/tscanlin/tocbot)## License
- MIT
## Credit
- Author: [Qrac](https://qrac.jp)
- Organization: [QRANOKO](https://qranoko.jp)