Skip to content

Commit

Permalink
feat: add KaTeX support and change rehypeKatex output format to 'html'
Browse files Browse the repository at this point in the history
  • Loading branch information
athrael-soju committed Jan 20, 2025
1 parent acac97c commit 6b0f627
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion components/markdown.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'katex/dist/katex.min.css';
import Link from 'next/link';
import React, { memo, useMemo, useState } from 'react';
import ReactMarkdown, { type Components } from 'react-markdown';
Expand Down Expand Up @@ -106,7 +107,7 @@ const NonMemoizedMarkdown = ({ children }: { children: string }) => {
return (
<ReactMarkdown
remarkPlugins={[remarkGfm, [remarkMath, { singleDollarTextMath: false }]]}
rehypePlugins={[[rehypeKatex, { output: 'markdown' }]]}
rehypePlugins={[[rehypeKatex, { output: 'html' }]]}
components={components}
>
{processedText}
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"fast-deep-equal": "^3.1.3",
"framer-motion": "^11.3.19",
"geist": "^1.3.1",
"katex": "^0.16.21",
"lucide-react": "^0.446.0",
"nanoid": "^5.0.9",
"next": "15.0.3-canary.2",
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6b0f627

Please sign in to comment.