Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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 }
// ]
```