sas*_*ero 4 html python jinja2
我有烧瓶、jinja2 和 python。
所以,我试图显示存储为 Markdown 的文本。
我这样做
class Article(db.Entity):
...
def html(self):
return markdown(self.text) # from markdown import markdown
Run Code Online (Sandbox Code Playgroud)
接下来我认为我这样做
html_text = article_.html()
return render_template('article.html', article=article_, comments=comments, user=user, text=html_text)
Run Code Online (Sandbox Code Playgroud)
在 article.html 我只有这一行
{{text}}
Run Code Online (Sandbox Code Playgroud)
因此,数据存储在 db 中,就像*im busy*我<p><em>im busy</em></p>在浏览器中一样。我尝试使用.replace('<', '<').replace('>', '>')但它没有任何改变。