首先要安装npm,到官网下载
然后全局安装doctoc插件
npm i doctoc -g
在markdown文件中打开cmd,或cd进入md文件目录
执行命令:
doctoc 文件名.md
在md文件需要生成命令的地方敲入[TOC]