nodejs, jade escape markup

后端 未结 5 1227
隐瞒了意图╮
隐瞒了意图╮ 2020-12-30 08:35

I have an Express app using the default Jade view engine. When I try to render HTML as-is in a

 element, it gets rendered as actual DOM elements inst         


        
5条回答
  •  长情又很酷
    2020-12-30 08:57

    As an addition, here is another use case which you need to consider:

    If you are extrapolating the HTML content using the #{...}, it will still give the wrong output. For that use case, you need the !{...} alternative.

    So,

    div= varname
    

    becomes

    div!= varname
    

    And

    div #{varname} is extrapolated badly
    

    becomes

    div !{varname} is extrapolated perfectly
    

提交回复
热议问题