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

react-latex

Package Overview
Dependencies
Maintainers
8
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.4.0 to 1.5.0

21

build/latex.js

@@ -33,18 +33,17 @@ "use strict";

string = string.replace(/(<([^>]+)>)/gi, "");
var regularExpression = /\$\$[\s\S]+?\$\$|\$[\s\S]+?\$/g;
var regularExpression = /\$\$[\s\S]+?\$\$|\\\[[\s\S]+?\\\]|\\\([\s\S]+?\\\)|\$[\s\S]+?\$/g;
var blockRegularExpression = /\$\$[\s\S]+?\$\$|\\\[[\s\S]+?\\\]/g;
var stripDollars = function stripDollars(stringToStrip) {
if (stringToStrip[1] === "$") {
stringToStrip = stringToStrip.slice(2, -2);
} else {
stringToStrip = stringToStrip.slice(1, -1);
}
return stringToStrip[0] === "$" && stringToStrip[1] !== "$" ? stringToStrip.slice(1, -1) : stringToStrip.slice(2, -2);
};
return stringToStrip;
var getDisplay = function getDisplay(stringToDisplay) {
return stringToDisplay.match(blockRegularExpression) ? "block" : "inline";
};
var renderLatexString = function renderLatexString(s) {
var renderLatexString = function renderLatexString(s, t) {
var renderedString = void 0;
try {
renderedString = _katex2.default.renderToString(s, options);
renderedString = _katex2.default.renderToString(s, t === "block" ? Object.assign(options, { displayMode: true }) : options);
} catch (err) {

@@ -71,3 +70,3 @@ console.error("couldn`t convert string", s);

string: stripDollars(latexMatch[index]),
type: "latex"
type: getDisplay(latexMatch[index])
});

@@ -88,3 +87,3 @@ }

}
return renderLatexString(r.string);
return renderLatexString(r.string, r.type);
});

@@ -91,0 +90,0 @@

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

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

@@ -1,2 +0,2 @@

# react-latex [![NPM version][npm-image]][npm-url][![Dependency Status][daviddm-image]][daviddm-url][![Build Status][travis-image]][travis-url]
# react-latex [![NPM version][npm-image]][npm-url]

@@ -3,0 +3,0 @@ > React component to render latex strings, based on [Katex](https://github.com/Khan/KaTeX)

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