1. 程式人生 > >how to render html tag

how to render html tag

api his urn turn 需要 turned not 所有 escape

使用autoescaping

If autoescaping is turned on in the environment, all output will automatically be escaped for safe output. To manually mark output as safe, use the safe filter. Nunjucks will not escape this output.

開啟autoescaping後,所有的輸出會自動轉義以獲得安全輸出.但是nunjucks模板不會自動轉義輸出,需要手動開啟,開啟方式:

{{ foo }}           // <span%gt;
{{ foo | safe }}    // <span>

how to render html tag