Skip to content

markdown-it plugin for rendering KaTeX formulas output by GPT

License

Notifications You must be signed in to change notification settings

SchneeHertz/markdown-it-katex-gpt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 },
  ]
})

About

markdown-it plugin for rendering KaTeX formulas output by GPT

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published