Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-latex

Package Overview
Dependencies
Maintainers
4
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-latex - npm Package Compare versions

Comparing version 1.5.0 to 1.6.0

47

build/latex.js

@@ -30,5 +30,3 @@ "use strict";

var latexString = function latexString(string, options) {
// Remove potential HTML
string = string.replace(/(<([^>]+)>)/gi, "");
var latexify = function latexify(string, options) {
var regularExpression = /\$\$[\s\S]+?\$\$|\\\[[\s\S]+?\\\]|\\\([\s\S]+?\\\)|\$[\s\S]+?\$/g;

@@ -48,3 +46,4 @@ var blockRegularExpression = /\$\$[\s\S]+?\$\$|\\\[[\s\S]+?\\\]/g;

try {
renderedString = _katex2.default.renderToString(s, t === "block" ? Object.assign(options, { displayMode: true }) : options);
// returns HTML markup
renderedString = _katex2.default.renderToString(s, t === "block" ? Object.assign({ displayMode: true }, options) : options);
} catch (err) {

@@ -87,8 +86,9 @@ console.error("couldn`t convert string", s);

}
return renderLatexString(r.string, r.type);
return _react2.default.createElement("span", { dangerouslySetInnerHTML: { __html: renderLatexString(r.string, r.type) } });
});
return newResult.join(" ");
return newResult;
};
// Returns list of spans with latex and non-latex strings.
return processResult(result);

@@ -124,20 +124,19 @@ };

return _react2.default.createElement("span", {
dangerouslySetInnerHTML: {
__html: latexString(children, {
displayMode: displayMode,
leqno: leqno,
fleqn: fleqn,
throwOnError: throwOnError,
errorColor: errorColor,
macros: macros,
minRuleThickness: minRuleThickness,
colorIsTextColor: colorIsTextColor,
maxSize: maxSize,
maxExpand: maxExpand,
strict: strict,
trust: trust
})
}
});
var renderUs = latexify(children, { displayMode: displayMode,
leqno: leqno,
fleqn: fleqn,
throwOnError: throwOnError,
errorColor: errorColor,
macros: macros,
minRuleThickness: minRuleThickness,
colorIsTextColor: colorIsTextColor,
maxSize: maxSize,
maxExpand: maxExpand,
strict: strict,
trust: trust });
renderUs.unshift(null);
renderUs.unshift('span'); //put everything in a span
// spread renderUs out to children args
return _react2.default.createElement.apply(null, renderUs);
}

@@ -144,0 +143,0 @@ }]);

{
"name": "react-latex",
"version": "1.5.0",
"version": "1.6.0",
"description": "React component to render latex strings",

@@ -5,0 +5,0 @@ "repository": "zzish/react-latex",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc