Charles-olivier Demers Charles-olivier Demers - 1 month ago 11
React JSX Question

REACT - What's the best way to keep text formatting

In a word document I have some text with exponent. I would like to know if there's any possibility to copy and paste the text with exponent in a Text Input of ReactJS and keep the text formatting.

Thanks in advance!

Answer Source

No, you can't just copy and paste some word formatted output and paste it into a textarea / text input.

Scientists are usually working with latex, so they did, before there were MS Word.

However, there are libraries which you can use to render the latex format into the DOM. like

There are also React Components as Wrappers for MathJax

This libraries will parse the latex input and create a styled output so it looks like in MSWord

However, if you just need the square² this is how you can write it 234²