Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zeromake/markdown-it-anchor
markdown-it support heading's anchor and toc on env
https://github.com/zeromake/markdown-it-anchor
Last synced: about 1 month ago
JSON representation
markdown-it support heading's anchor and toc on env
- Host: GitHub
- URL: https://github.com/zeromake/markdown-it-anchor
- Owner: zeromake
- Created: 2019-08-28T16:28:24.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-12-11T19:24:30.000Z (about 4 years ago)
- Last Synced: 2024-03-01T15:31:56.984Z (10 months ago)
- Language: JavaScript
- Size: 337 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## markdown-it-anchor
[markdown-it](https://github.com/markdown-it/markdown-it) support anchors.
## Usage
``` js
const md = require('markdown-it')()
.use(require('@zeromake/markdown-it-anchor'), opt);
const env = {
tocs: []
};md.render(`## 1.Test\n\n## 2. Faset\n\n## 2.1 gg`, env);
//
// ¶1.Test
//
// ¶2. Faset
//
// ¶2.1 gg
console.log(env.tocs);
// [
// { id: '1-Test', title: '1.Test', level: 2 },
// { id: '2-Faset', title: '2. Faset', level: 2 },
// { id: '2-1-gg', title: '2.1 gg', level: 2 }
// ]
```