搞定 。
实现效果把生成的树结构打印一下
[{"Text": "DjangoAdmin","Href": "#DjangoAdmin","Tags": null,"Nodes": [{"Text": "一些参考资料","Href": "#一些参考资料","Tags": null,"Nodes": null}]},{"Text": "界面主题","Href": "#界面主题","Tags": null,"Nodes": [{"Text": "SimpleUI","Href": "#SimpleUI","Tags": null,"Nodes": [{"Text": "一些相关的参考资料","Href": "#一些相关的参考资料","Tags": null,"Nodes": null}]},{"Text": "django-jazzmin","Href": "#django-jazzmin","Tags": null,"Nodes": null}]},{"Text": "定制案例","Href": "#定制案例","Tags": null,"Nodes": [{"Text": "添加自定义列","Href": "#添加自定义列","Tags": null,"Nodes": [{"Text": "效果图","Href": "#效果图","Tags": null,"Nodes": null},{"Text": "实现过程","Href": "#实现过程","Tags": null,"Nodes": null},{"Text": "扩展:添加链接","Href": "#扩展:添加链接","Tags": null,"Nodes": null}]},{"Text": "显示进度条","Href": "#显示进度条","Tags": null,"Nodes": [{"Text": "效果图","Href": "#效果图","Tags": null,"Nodes": null},{"Text": "实现过程","Href": "#实现过程","Tags": null,"Nodes": null}]},{"Text": "页面上显示合计数额","Href": "#页面上显示合计数额","Tags": null,"Nodes": [{"Text": "效果图","Href": "#效果图","Tags": null,"Nodes": null},{"Text": "实现过程","Href": "#实现过程","Tags": null,"Nodes": [{"Text": "admin.py","Href": "#admin.py","Tags": null,"Nodes": null},{"Text": "template","Href": "#template","Tags": null,"Nodes": null}]},{"Text": "参考资料","Href": "#参考资料","Tags": null,"Nodes": null}]},{"Text": "分权限的软删除","Href": "#分权限的软删除","Tags": null,"Nodes": [{"Text": "实现过程","Href": "#实现过程","Tags": null,"Nodes": [{"Text": "models.py","Href": "#models.py","Tags": null,"Nodes": null},{"Text": "admin.py","Href": "#admin.py","Tags": null,"Nodes": null}]}]}]},{"Text": "扩展工具","Href": "#扩展工具","Tags": null,"Nodes": [{"Text": "Django AdminPlus","Href": "#Django AdminPlus","Tags": null,"Nodes": null},{"Text": "django-adminactions","Href": "#django-adminactions","Tags": null,"Nodes": null}]}]
完整代码我把这个功能封装成一个方法,方便调用 。
直接上GitHub Gist:https://gist.github.com/Deali-Axy/436589aaac7c12c91e31fdeb851201bf
接下来可以尝试使用后端来渲染Markdown文章了~
【C#实现生成Markdown文档目录树】
经验总结扩展阅读
- 利用inotify和rsync服务实现数据实时同步
- OpenAPI 接口幂等实现
- 如何实现一个SQL解析器
- Spring 深入——IoC 容器 02
- 函数柯里化实现sum函数
- 使用 Windows Core Audio APs 进行 Loopback Recording 并生成 WAV 文件
- 使用react+redux实现弹出框案例
- Java实现7种常见密码算法
- [WPF] 抄抄超强的苹果官网滚动文字特效实现
- 如何让处女座女生成为一名优秀的女票