Socket
Book a DemoInstallSign in
Socket

markdown-it-katex-gpt

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

markdown-it-katex-gpt

markdown-it plugin for rendering KaTeX formulas output by GPT

latest
Source
npmnpm
Version
1.1.1
Version published
Maintainers
1
Created
Source

markdown-it-katex-gpt

A simple markdown-it plugin for rendering KaTeX formulas generated by the GPT series LLM.

Default parsing of (\[, \]) and (\(, \)) two sets of tokens.

Installation

npm install markdown-it-katex-gpt

Usage

import MarkdownIt from 'markdown-it'
import markdownItKatexGpt from 'markdown-it-katex-gpt'
const md = new MarkdownIt()
md.use(markdownItKatexGpt)
let result = md.render(`
\\[ F = G \\frac{{m_1 \\times m_2}}{{r^2}} \\]

\\( \\boxed{\\pi=\\frac c d} \\) | \\( a\\raisebox{0.25em}{$b$}c \\) | \\( \\overbrace{a+b+c}^{\\text{note}} \\)

\\( \\Braket{ ϕ | \\frac{∂^2}{∂ t^2} | ψ } \\)

\\[
x = \\begin{cases}
   a &\\text{if } b \\\\
   c &\\text{if } d
\\end{cases}
\\]
`)
console.log(result)

example.jpg

Configure

md.use(markdownItKatexGpt, {
  delimiters: [
    { left: '\\[', right: '\\]', display: true },
    { left: '\\(', right: '\\)', display: false },
    { left: '$$', right: '$$', display: false },
  ]
})

Keywords

markdown-it

FAQs

Package last updated on 25 Mar 2025

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