简体   繁体   中英

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. 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:

return new Handlebars.SafeString(text)

See the documentation ( HTML Escaping ) or the discussion here: https://github.com/wycats/handlebars.js/issues/647

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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