django 初步渲染 markdown

def test(request, *args, **kwargs):
with open('templates/课程学习相关表结构设计 v0.2.0.md', 'r', encoding='UTF-8') as f:
content = f.read()

return render(request, 'test.html',
{'content': markdown.markdown(content, extensions=['markdown.extensions.extra','markdown.extensions.codehilite','markdown.extensions.toc'])})


urlpatterns = [
path('', test),
path('admin/', admin.site.urls),

]
posted @ 2022-02-15 15:33  Luciferl  阅读(49)  评论(0编辑  收藏  举报