Automatically create a table of contents.
The idea is that you can automatically create a table of contents from your markdown text.
PRs/Issues are always welcome.
npm install --save react-auto-toc
Pass your markdown content as a prop.
import React, { Component } from 'react'
import Toc from 'react-auto-toc'
class Example extends Component {
render() {
const content = '# test \n your markdown Content # test2\n'
return <Toc markdownText={content} />
}
}
The list(ul
) has a class called toc-list
and each item(li
) has header1
, header2
or header3
as its class. Lastly, every title(a
) has a class called toc-title
.
You can add styles to them in your css files.
MIT © K-Sato1995