question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How do you use htmlSafe in a helper?

See original GitHub issue

Copied from an Ember helper:

import { htmlSafe } from '@ember/string';

helper() {
  return htmlSafe(' ');
}

How can you do that in a Glimmer helper?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
rondale-sccommented, Oct 29, 2018

Not sure the exact correct way, but for future travelers the glimmer-vm now supports returning an object with this shape:

https://github.com/glimmerjs/glimmer-vm/pull/133

{
  string: 'your string goes here',
  toHTML() {
    return this.string;
  },
  toString() {
    return this.string;
  }
};

And it will treat it as a safeString (could use some verification)

0reactions
lockscommented, Feb 15, 2022

Closing due to inactivity!

Read more comments on GitHub >

github_iconTop Results From Across the Web

htmlSafe - 4.8 - Ember API Documentation
Use this method to indicate that a string should be rendered as HTML when the string is used in a template. To say...
Read more >
Helper not recognizing the `htmlSafe` stuff - Stack Overflow
I am trying to retun a value with space added through helper . but I am not getting the result. here is my...
Read more >
html_safe (String) - APIdock
html_safe () public ... This method is equivalent to the raw helper in views. It is recommended that you use sanitize instead of...
Read more >
Found unsafe method htmlSafe() JS-S1007 - DeepSource
Define your own trusted sanitizing Handlebars helper. htmlSafe marks a string as safe for unescaped output with Ember templates so you can render...
Read more >
ember-cli-string-helpers - npm
String helpers for Ember. Latest version: 6.1.0, last published: 2 years ago. Start using ember-cli-string-helpers in your project by ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found