【发布时间】:2019-04-08 02:48:54
【问题描述】:
我在 python 中使用 markdown 库在我的烧瓶应用程序中显示一些 markdown。 我在显示输出时遇到错误,因为它显示的是降价内容而不将其转换为 HTML。
这是我的 Python 代码。
import markdown
from flask import Flask
#import some other libraries
@app.route('/md')
def md():
content = """
<h1>Hello</h1>
Chapter
=======
Section
-------
* Item 1
* Item 2
**Ishaan**
"""
content = Markup(markdown.markdown(content))
return render_template('md.html', **locals())
这是我的 html 代码。
<html>
<head>
<title>Markdown Snippet</title>
</head>
<body>
{{ content }}
</body>
</html>
我正在关注here的代码
我知道我做错了,但如果有人帮助我,我将不胜感激。 提前致谢。
【问题讨论】: