$ npm install @leisn/markdown-it-toc or $ yarn add @leisn/markdown-it-toc E.g. default Source markdown [toc]#H1-1##H2-1###H3-1#H1-2 Result document <p><divid="toc"class="toc-wrapper"><ul><li><ahref="#toc.1"><spanclass="toc-item-index">1</span>H1-1</a></li>...
markdownIt({ html: true, linkify: true, typographer: true, }) .use(markdownItTocAndAnchor, { tocCallback: function(tocMarkdown, tocArray, tocHtml) { console.log(tocHtml) } }) .render(md) To allow callback to be more flexible, this option is also available in global markdown-it ...
由于markdown-it本身是同步的,所以不需要担心异步问题,当markdown-it运行完成后,变量一定会指向生成好的目录对象(除非你没给他赋值) importmarkdownitfrom'markdown-it'letmenuTree,mdLinkHTMLconstmd=markdownit({html:true,linkify:true,typography:true}).use(markdownItToc,{// Set directory level(设定目录级...
https://dwatow.github.io/2018/01-28-hexo/how-to-hexo-markdown-it-toc/ ¶markdown-it 如何順利使用 toc 在 hexo 這個文章標題有點難解釋。 首先,這是解決 hexo 的問題。(就是此 blog 產生器的問題) 但是,要改 markdown-it 渲染器才有的問題。 最後,這個問題是 我的 toc 都是 #undefined ¶...
"markdownit".varmd=window.markdownit({html:false,xhtmlOut:true,typographer:true}).use(window.markdownItAnchor,{permalink:true,permalinkBefore:true,permalinkSymbol:'§'}).use(window.markdownItTocDoneRight);varresult=md.render("# markdown-it rulezz!\n\n${toc}\n## with markdown-it-toc-...
* Options for markdown-it-toc-done-right * * @see https://github.com/nagaozen/markdown-it-toc-done-right#options */ exportinterfaceTocPluginOptions{ /** * The pattern serving as the TOC placeholder in your markdown */ placeholder?:string ...
Exclude the first h1-level heading in a file. For example, this prevents the first heading in a README from showing up in the TOC. options.stripHeadingTags Type:Boolean Default:true Strip extraneous HTML tags from heading text before slugifying. This is similar to GitHub markdown behavior. ...
var markdownIt = require('markdown-it'), markdownItTocAndAnchor = require('markdown-it-toc-and-anchor').default; markdownIt({ html: true, linkify: true, typographer: true, }) .use(markdownItTocAndAnchor, { // ...options }) .render(md)...
markdown-it-toc-better The markdown-it plug-in is used to output a directory DOM or directory tree object to a markdown document markdown-it插件,用于输出目录DOM或目录树对象到markdown文档 Usage Enable plugin import markdownit from 'markdown-it' import markdownItToc from 'markdow-it-toc-be...
The markdown-it plug-in is used to output a directory DOM or directory tree object to a markdown document - GXYyz/markdown-it-toc-better