Math
Writing math equations in Markdown/MDX documents
Next Docs UI doesn't bundle with other plugins, you have to manually install
those plugins.
npm install remark-math rehype-katex katex
Add the remark/rehype plugins you have installed above.
Assume you're using the default contentlayer configuration:
import { makeSource } from 'contentlayer/source-files'
import { createConfig } from 'next-docs-zeta/contentlayer/configuration'
import rehypeKatex from 'rehype-katex'
import remarkMath from 'remark-math'
const config = createConfig(...)
config.mdx!.remarkPlugins!.push(remarkMath)
config.mdx!.rehypePlugins!.push(rehypeKatex)
export default makeSource(config)
In order to make it looks great on the client, add the following to root layout:
import 'katex/dist/katex.css'
Type some TeX expression in your documents
$c = \pm\sqrt{a^2 + b^2}$
c=±a2+b2
Long equations example
a1†a2†a2n†=2X−iY⊗I⊗I⊗...⊗I=Z⊗2X−iY⊗I⊗...⊗I⋮=Z⊗Z⊗Z⊗...⊗2X−iY