Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to pass HTML content as message? #63

Closed
vedmant opened this issue Apr 22, 2016 · 6 comments
Closed

Is there a way to pass HTML content as message? #63

vedmant opened this issue Apr 22, 2016 · 6 comments

Comments

@vedmant
Copy link

vedmant commented Apr 22, 2016

My messages are generated on backend and have many translations and different types, meaning it will be inefficient to make all this possible templates and translations on front end. But it looks like NotifyJs escapes HTML content, is there any way to pass HTML without escaping?

@jpillora
Copy link
Owner

jpillora commented Jun 8, 2016

You can though you need to use a custom style. The default style is defined here https://github.com/notifyjs/notifyjs/blob/master/dist/notify.js#L585-L625. You'll notice the template has data-notify-text, in your style - use data-notify-html instead - see Custom Styling Guide in the docs

@jpillora jpillora closed this as completed Jun 8, 2016
@vedmant
Copy link
Author

vedmant commented Jun 8, 2016

The problem was that that it escapes message string passed to function. I
just made little fix in JS code and removed that line where it escapes
message string.
On Jun 8, 2016 12:47 PM, "Jaime Pillora" [email protected] wrote:

You can though you need to use a custom style. The default style is
defined here
https://github.com/notifyjs/notifyjs/blob/master/dist/notify.js#L585-L625.
You'll notice the template has data-notify-text, in your style - use
data-notify-html instead - see Custom Styling Guide in the docs
https://notifyjs.com/


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#63 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AE0X9j5QbBfc4t5EOwo3IRSaB6LOFjCqks5qJwA0gaJpZM4INymY
.

@rajitha-bandara
Copy link

This is really useful. Much better if there is an option to allow html.

@danimesq
Copy link

danimesq commented Jul 9, 2016

@jpillora

@jaysoni-india
Copy link

jaysoni-india commented Jun 21, 2018

$.notify.addStyle('happyblue', { html: "<div>☺<span data-notify-text/>☺</div>", classes: { base: { "white-space": "nowrap", "background-color": "lightblue", "padding": "5px" }, superblue: { "color": "white", "background-color": "blue" } } [});](https://notifyjs.jpillora.com/)

@rokobuljan
Copy link

Seems related to Issue #130

I created a pull request - seems like an easy addon.

// To be used like:
$.notify("Lorem<br><b>Ipsum</b>", {encode: false});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants