remark extract toc 源码
备注提取目录 这是一个插件,用于将文档目录附加到VFile。 如何安装 yarn add @stefanprobst/remark-extract-toc 如何使用 const remark = require ( "remark" ) const withSlugs = require ( "remark-slug" ) const withToc = require ( "@stefanprobst/remark-extract-toc" ) const processor = remark ( ) . use ( withSlugs ) . use ( withToc ) const { data , contents } = processor . processSync ( doc ) console . dir ( data . toc , { depth : null } )
用户评论