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

rehype-katex

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rehype-katex - npm Package Compare versions

Comparing version 0.2.3 to 1.0.0

18

index.js

@@ -26,7 +26,7 @@ const visit = require('unist-util-visit')

if (opts.throwOnError == null) opts.throwOnError = false
if (opts.errorColor == null) opts.errorColor = '#cc0000'
return function transform (node, file) {
visit(node, 'element', function (element) {
const isInlineMath = isTag(element, 'span') && hasClass(element, 'inlineMath')
const isMath = (opts.inlineDoubleDisplay && hasClass(element, 'inlineMathDouble')) ||
(isTag(element, 'div') && hasClass(element, 'math'))
const isMath = (opts.inlineMathDoubleDisplay && hasClass(element, 'inlineMathDouble')) || (isTag(element, 'div') && hasClass(element, 'math'))

@@ -47,7 +47,11 @@ if (isInlineMath || isMath) {

)
renderedValue = katex.renderToString(element.children[0].value, {
displayMode: isMath,
throwOnError: false,
errorColor: opts.errorColor
}, 'katex-parse-error')
try {
renderedValue = katex.renderToString(element.children[0].value, {
displayMode: isMath,
throwOnError: false,
errorColor: opts.errorColor
})
} catch (err) {
renderedValue = '<code class="katex" style="color: ' + opts.errorColor + '">' + element.children[0].value + '</code>'
}
}

@@ -54,0 +58,0 @@ }

{
"name": "rehype-katex",
"version": "0.2.3",
"version": "1.0.0",
"description": "KaTeX transform plugin for rehype",

@@ -5,0 +5,0 @@ "main": "index.js",

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