目测无法识别html

Kun*_*_89 3 aem sightly

我有将 html 作为字符串值返回的方法。我认为在显示时它会在浏览器上以粗体显示字符串,但它向我显示的字符串与浏览器上的一样。

public String getHtml() {
        return "<b>kunal</b>";
    }

<sly data-sly-use.item="demo.html.DemoHtml">
    ${item.html}
</sly>
Run Code Online (Sandbox Code Playgroud)

输出:

<b>kunal</b>
Run Code Online (Sandbox Code Playgroud)

有什么解决方法吗?

Vla*_*lad 5

HTL/Sightly 包含 XSS 保护,默认情况下会转义字符串,除非您明确告知它包含 HTML(请参阅https://github.com/Adobe-Marketing-Cloud/htl-spec/blob/master/SPECIFICATION.md#121-显示上下文):

${item.html @ context='html'}
Run Code Online (Sandbox Code Playgroud)