简体   繁体   English

木偶模型数据包含格式化html标签,例如 <sup></sup> 。 我如何才能在输出中尊重这些标签?

[英]Marionette model data contains formatting html tags like <sup></sup>. How can I have my view honor those tags in its output?

I'm using handlebars for my templates. 我正在为模板使用把手。 The data in my model is pulled from SQL tables. 我模型中的数据是从SQL表中提取的。 Users enter this data in a form elsewhere. 用户以其他形式输入此数据。 Its medical data so sometimes the users want elements within the data to be formatted with things like superscripts. 它的医疗数据,因此有时用户希望数据中的元素使用上标之类的格式进行格式化。 Is there a way to honor such formatting in handlebars templates? 有没有办法在把手模板中采用这种格式?

By default, Handlebars will escape everything, unless you pass your text as an instance of Handlebars.SafeString: 默认情况下,除非您将文本作为Handlebars.SafeString的实例传递,否则Handlebars将转义所有内容:

return new Handlebars.SafeString(text)

See the documentation ( HTML Escaping ) or the discussion here: https://github.com/wycats/handlebars.js/issues/647 请参阅文档HTML Escaping )或此处的讨论: https : //github.com/wycats/handlebars.js/issues/647

暂无
暂无

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

相关问题 JS sup()在html中显示标签 - JS sup() displaying tags in html 如何将HTML中显示的数字格式设置为货币格式,包括$符号并使用 <sup></sup> ? - How can I format number shown in HTML to currency format, including the $ symbol and placing decimals with <sup></sup>? 如何将 HTML 元素(如“ <sup>X</sup> ”)替换为“(X)”等括号? - How to replace HTML elements like `<sup>X</sup>` by parentheticals like `(X)`? TinyMCE不会让我上标并去除我的sup标签 - TinyMCE won't let me superscript and strips out my sup tags VSCode(或其他工具)自动将<sup>标签</sup>添加<sup>到参考编号</sup> - VSCode (or other tool) auto add <sup> tags to reference numbers 无法使用 sup 标签使商标符号加粗 - Unable to make the trademark symbol bold using sup tags <sup>在所有商标和注册商标符号周围</sup>添加上标<sup>标签</sup> - Adding superscript <sup> tags around all trademark and registered trademark symbols 检测字符串中的“模式”,并将其<sup>标签</sup>包装<sup>在javascript(角度)中</sup> - Detect “pattern” in a string and wrap it <sup> tags in javascript(angular) 如何迭代/循环包含 HTML 标记的文本字符串,同时忽略 Javascript 中的那些 HTML 标记? - How to iterate/loop over a text string that contains HTML tags while ignoring those HTML tags in Javascript? 如何使用 jQuery 从字符串中删除输入标签? 该字符串还包含其他 html 标签 - How can I remove input tags from a string using jQuery? This string contains other html tags as well
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM