markdown-it-katex-gpt
v1.1.0
Published
markdown-it plugin for rendering KaTeX formulas output by GPT
Downloads
1,962
Maintainers
Readme
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)
Configure
md.use(markdownItKatexGpt, {
delimiters: [
{ left: '\\[', right: '\\]', display: true },
{ left: '\\(', right: '\\)', display: false },
{ left: '$$', right: '$$', display: false },
]
})