Charles-olivier Demers
Charles-olivier Demers

Reputation: 1048

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!

Upvotes: 3

Views: 3422

Answers (1)

webdeb
webdeb

Reputation: 13211

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 https://en.wikipedia.org/wiki/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 https://www.mathjax.org/

There are also React Components as Wrappers for MathJax https://www.npmjs.com/package/react-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²

Upvotes: 3

Related Questions