-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Allow HTML in announcement content #33
Comments
Just following up on this, it is somewhat possible when running the custom parser on data and using the built in banner. The only thing I have noticed in testing is that the spaces around the elements get lost. So the string would have to be But will look at this, although I will make sure people know that they will need to sanitize their content before doing that if they aren't sure where it's from |
Right, it would be the dev's responsiblity to sanitize content. I'm also proposing to consider having
In my naivety, I thought this would be done just by setting |
When I made v2 it was designed to allow a person to pass there own rendering options into it through the template option. This was to allow custom HTML, I know it's not in the docs at the moment that might be what you are looking for? That allows for rendering a completely custom thing. There is the option to actually provide a render class that can return the HTML you want written to the document. As mentioned, these came in on v2, but didn't document them yet. |
With using setHTML: I hadn't gone with the setHTML option initially I think cause of the support option, but I hopefully if there is some more browser compat I can slowly add that. It is one of the reasons why I gave provision for using DOMPurify, at least some could have the option. Given that it's on Chrome and some other browsers I'll look at adding it and then give a suggestion if it isn't that DOMPurify can be used.
^ the above isn't true now since the adjustment of the issue title. But the below explains more of what I was talking about. Sorry, clarification on this, the parser is the part that takes what is defined in the templates that have |
Thanks for clarifications, Reece!
Yes! I think it would be useful to step back and clarify the high level goal of h-bar. IMHO, it focused on a very narrow use case: Load JSON from an URL to display a link (with implementation having a template engine included). A larger use case would be: Display one or more announcements (one at a time), given as HTML content. This would cover my use case and many others, including the original (but not forcing it). Examples:
It's easy for the developer to use a templating engine if they wish (eg Handlebars) to produce that HTML, or get the content (JSON or HTML) from an API. These could even be in h-bar examples, but not bundled in the library. If you think 'Display some HTML' is too simple, I'd still prefer to use a library instead of rolling my own. It needs to
I also liked the themes and badges support, which I wouldn't have thought about. What do you think? Implementation note: [
{ content: "Happy holidays!" },
{ content: "Happy holidays!" },
...
] Note that this doesn't directly provide a list of HTMLs, just in case each announcement might have some other options in future. |
Hi, thank you for the suggestions on the package. It was intended to be a simple solution initially, but I am open to extending it and happy to have this feedback. I've been going over the suggestions above and will come back here to this thread, thank you for them, I wasn't ignoring them 👍 |
Thank you Reece! Happy holidays :) |
Hi Reece, hope this finds you well. Curios to learn about your decision. Thanks |
Hi Marius, the message does find me well :) hope the same goes for you 👍 I just had a bit of a busy month and a bit pushing features out for a client but I'm happy with where this feature would go for the package. |
Great, thanks Reece! |
Please allow HTML in announcement title, eg
Latest <b>version</b> available ${name}
The text was updated successfully, but these errors were encountered: