MarkDown自动生成目录(文章开头或者侧边目录)

2018-05-11  本文已影响0人  Pandakingli

1、使用doctoc 生成目录 在文章开头

// 安装
npm install -g doctoc
//有可能报错
Unexpected end of JSON input while parsing near '...":{},"_hasShrinkwrap"'
//运行  下面的命令
npm cache clean --force
// doctoc用法
// 指定单个文件
doctoc xx.md
// 指定目录
doctoc .

如果没有安装npm,可以先安装homebrew
网址:https://brew.sh/
命令:/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

然后安装npm: brew install node

2、使用tocmd 生成目录 在侧边栏

// 安装
gem install tocmd

// 用法
// 指定单个文件  //生成1.html
 tocmd -f 1.md
// 指定目录
 tocmd -d .

上一篇下一篇

猜你喜欢

热点阅读