简体   繁体   English

如何在Phoenix框架中呈现原始HTML

[英]How to render raw html in Phoenix framework

I am trying to render raw html like this -> 我正在尝试像这样呈现原始html->

<%= raw "<noscript>\n <div style=\"width: 302px; height: 422px;\">\n </div>\n </noscript> \n\n\n" %>

but when I use Edit as Html in Chrome to get the code I see the following -> 但是,当我在Chrome中使用“ Edit as Html获取代码时,会看到以下内容->

<noscript>
  &lt;div style="width: 302px; height: 422px;"&gt; &lt;/div&gt;    
</noscript>

which is obviously not what I want. 这显然不是我想要的。 What am I missing here? 我在这里想念什么? Why the content inside the noscript is being escaped? 为什么noscript的内容被转义? What's the right way to render this string as html ? 将此字符串呈现为html的正确方法是什么?

This isn't a Phoenix issue. 这不是Phoenix的问题。 This is just how chrome handles when you edit as html. 这就是chrome处理为html时的处理方式。 You can see the same thing in action at http://jsfiddle.net/h6crtf2m 您可以在http://jsfiddle.net/h6crtf2m看到相同的内容

<noscript><div></div></noscript>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM