1.python安装markdown库
pip install markdown
2.blog下新建 templatetags文件夹

3.blog下templatetags目录新建 custom_markdown.py文件

4.在再的html文档的首行添加 {% load custom_markdown%}
5.在需要进行markdown过滤的文本后面添加过滤器 如 {{ item.body|custom_markdown}}

目前markdown实现的功能不是很完善,仔细想了下,暂时不需要markdown的功能,先不考虑这个了。
网友评论