Support for html inside text
See original GitHub issueFirst of all, I just wanted to say thanks for putting this together!
I think it would be great if there was support for html inside text. In other words something like the Trans
component in next-translate
.
My use case is a long paragraph with different styling for different parts of the text. The alternative would be to just have a bunch entries in my .json translations file, instead of one for the whole paragraph.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
HTML Text Formatting - W3Schools
Formatting elements were designed to display special types of text: ... The HTML <ins> element defines a text that has been inserted into...
Read more >HTML text fundamentals - Learn web development | MDN
This article explains the way HTML can be used to structure a page of text by adding headings and paragraphs, emphasizing words, creating...
Read more >Rendering HTML inside textarea - javascript - Stack Overflow
An addendum to this: You can use character entities (such as changing <div> to <div> ) and it will render in the textarea....
Read more >Structural markup and right-to-left text in HTML - W3C
This article looks at ways of handling text direction for structural markup in HTML, ie. at the document level and for elements like ......
Read more >HTML text control in Power Apps - Microsoft Learn
An HTML text control not only shows plain text and numbers but also converts HTML tags, such as non-breaking spaces. Note. HTML text...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, innerHTML, totally depends on your threat model. You can also think about using the translated string through something like https://github.com/cure53/DOMPurify
Cheers!
Thanks for replying so quick and for the suggestions! I can see how the first suggestion would work and guess it should be fine from a security since it’s me adding the html. I will give this a go and if it doesn’t work out, will maybe submit a PR to add something like the Trans component I mentioned