django 模版渲染的时候,把{{ article.content }}中范例的 " img标签" 也给渲染了,求教有什么办法避免?
{% autoescape on %}
{{ article.content }}
{% endautoescape %}
ps :高亮代码时, 我使用了highlight.js
django 模版渲染的时候,把{{ article.content }}中范例的 " img标签" 也给渲染了,求教有什么办法避免?
{% autoescape on %}
{{ article.content }}
{% endautoescape %}
ps :高亮代码时, 我使用了highlight.js
最后找了一个很苦逼折中的办法 符号转意下可以了
<pre>
<code class="django">
{% load static from staticfiles %}
<img src="{% static 'images/rooster.png' %}"/>
</code>
</pre>
1 回答1.4k 阅读✓ 已解决
1 回答841 阅读✓ 已解决
1 回答456 阅读✓ 已解决
html的内容可以用
<
pre>,django的模板可以用
{% verbatim %} ... {% endverbatim %}