Mathematics node styles
Open source
The mathematics-node registry item adds an editable stylesheet to your project. The Mathematics extension creates the math nodes and renders LaTeX with KaTeX.
Install
In a React project with Tiptap and StarterKit, install the math extension, its renderer, and the node styles.
npm install @tiptap/extension-mathematics katex
npx @tiptap/cli@latest add mathematics-nodeUsage
'use client'
import { Mathematics } from '@tiptap/extension-mathematics'
import { EditorContent, useEditor } from '@tiptap/react'
import { StarterKit } from '@tiptap/starter-kit'
import 'katex/dist/katex.min.css'
import '@/components/tiptap-node/mathematics-node/mathematics-node.scss'
export default function MathEditor() {
const editor = useEditor({
immediatelyRender: false,
extensions: [StarterKit, Mathematics],
content: '<p>Area of a circle: <span data-type="inline-math" data-latex="A=\\pi r^2"></span></p>',
})
return <EditorContent editor={editor} />
}