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

rehype-katex

Package Overview
Dependencies
Maintainers
3
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rehype-katex

rehype plugin to transform inline and block math with KaTeX

  • 7.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created

What is rehype-katex?

The rehype-katex package is a plugin for the rehype ecosystem that allows you to transform LaTeX math expressions into HTML using KaTeX. This is particularly useful for rendering mathematical content in web pages.

What are rehype-katex's main functionalities?

Basic LaTeX to HTML Conversion

This feature allows you to convert LaTeX math expressions within your HTML content into properly formatted HTML using KaTeX. The code sample demonstrates how to use rehype-katex to process a string containing a LaTeX expression.

const rehype = require('rehype');
const rehypeKatex = require('rehype-katex');

const html = rehype()
  .use(rehypeKatex)
  .processSync('Here is some math: $E = mc^2$')
  .toString();

console.log(html);

Custom KaTeX Options

This feature allows you to customize the behavior of KaTeX by passing options. In the code sample, the `throwOnError` option is set to `false` to prevent errors from being thrown, and `errorColor` is set to customize the color of error messages.

const rehype = require('rehype');
const rehypeKatex = require('rehype-katex');

const html = rehype()
  .use(rehypeKatex, { throwOnError: false, errorColor: '#cc0000' })
  .processSync('Here is some math: $E = mc^2$')
  .toString();

console.log(html);

Other packages similar to rehype-katex

Keywords

FAQs

Package last updated on 19 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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