react-latex | React component to render Latex strings | Frontend Framework library
kandi X-RAY | react-latex Summary
kandi X-RAY | react-latex Summary
React component to render Latex strings
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of react-latex
react-latex Key Features
react-latex Examples and Code Snippets
Community Discussions
Trending Discussions on react-latex
QUESTION
I have some columns in a database that contain strings with latex and html.
For example :
Levels of $^{13}$CN (up to N=12) (Link)
I am using react-latex to render the text in a page:
...ANSWER
Answered 2020-Jul-31 at 12:09HTML code is escaped in React to prevent Cross-site Scripting (XSS) and similar attacks. In short React prevents rendering HTML as code from string variables so that someone can't tamper with those strings and input code that runs on other users' machines.
In your example, if users are the ones uploading those LaTeX files, a user can add whatever (malicious) code to that LaTeX file and it will run on the browser of the user that opens that file in via your app.
react-latex
(if we're talking about this library) seems to only be React a wrapper for KaTeX and uses that library for creating an HTML string and then uses the dangerouslySetInnerHTML
property to render it. This could be a security issue based on what I've described above. If all the LaTeX files come from a trusted and strictly controlled source and only really trusted users (basically admin level) can add those files you're ok, but if not please have a look at more advanced KaTeX trust
option settings.
That all out of the way, I suppose the issue is that KaTeX does not support HTML code the way you've inputed it and if you only need to add that link you can just do something like:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install react-latex
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page