bytemd-plugin-math
v0.0.1
Published
A bytemd plugin for rendering math formulae
Maintainers
Readme
bytemd-plugin-math
A bytemd plugin for rendering math formulae with KaTeX.
This package also publishes bytemd-plugin-math/styles/katex.css, so you can import KaTeX styles directly from the plugin package instead of reaching for katex/dist/katex.css.
The bundled styles ship with the required font assets under dist/styles/fonts/.
Usage
pnpm add bytemd @bytemd/react bytemd-plugin-mathimport { Editor } from '@bytemd/react'
import math from 'bytemd-plugin-math'
import { useState } from 'react'
import 'bytemd/dist/index.css'
import 'bytemd-plugin-math/styles/katex.css'
const plugins = [math()]
export default function App() {
const [value, setValue] = useState('$E=mc^2$')
return <Editor value={value} plugins={plugins} onChange={setValue} />
}Options
You can pass locale and katexOptions to customize toolbar labels and KaTeX rendering behavior.
const plugins = [
math({
katexOptions: {
macros: {
'\\RR': '\\mathbb{R}',
},
},
}),
]Credits ❤️
Based on @bytemd/plugin-math
Powered by KaTeX
License
MIT License © Frankie
