Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

markdownToHTML时支持获取TOC树 #972

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Deali-Axy
Copy link

我写了一篇博客来介绍这个功能:魔改editormd组件,优化ToC渲染效果


markdownToHTML 方法在渲染 HTML 的时候生成的 Toc 不支持自定义,我把 ToC 拿出来转换为树结构,支持进一步定制。

原版是在 markdownToHTML 方法执行完直接返回一个 div 元素,我则是在返回的 div 元素上添加了两个属性,然后再返回 div:

div.markdownToc = markdownToC
div.markdownTocTree = editormd.tocListToTree(markdownToC)
return div

这样在使用的时候就可以方便的将 Bootstrap-Treeview 组件整合进来了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant