This is a vuepress plugin for ordering headers in the sidebar.
Like this:
# header 1
## header 1-1
### header 1-1-1
## header 1-2
# header 2
And the sidebar will be:
1 header 1
1.1 header 1-1
1.1.1 header 1-1-1
1.2 header 1-2
2 header 2
You can install it via npm or other.
npm install vuepress-plugin-ordered-header
In vuepress config file, add the plugin to the plugins array.
import orderedHeader from "vuepress-plugin-ordered-header";
module.exports = {
plugins: [orderedHeader],
markdown: {
headers: {
level: [2, 3, 4],
},
},
};
If you use vuepress-theme-hope
,you also need to add the following config in theme
:
export default hopeTheme(
headerDepth: 3, // the depth header you want to render.
)