feat: Add rehype-katex dependency for rendering math equations in Markdown
This commit is contained in:
parent
68bd3e651b
commit
52ccbc67bb
@ -48,6 +48,7 @@
|
||||
"react-router-dom": "6.10.0",
|
||||
"react-syntax-highlighter": "^15.5.0",
|
||||
"react-toastify": "^10.0.4",
|
||||
"rehype-katex": "6.0.3",
|
||||
"rehype-mathjax": "4.0.3",
|
||||
"remark-gfm": "3.0.1",
|
||||
"remark-math": "5.1.1",
|
||||
|
@ -1,13 +1,12 @@
|
||||
import remarkGfm from "remark-gfm"
|
||||
import remarkMath from "remark-math"
|
||||
import ReactMarkdown from "react-markdown"
|
||||
|
||||
import "property-information"
|
||||
import React from "react"
|
||||
import { CodeBlock } from "./CodeBlock"
|
||||
|
||||
|
||||
export default function Markdown({ message }: { message: string }) {
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
<ReactMarkdown
|
||||
@ -17,10 +16,10 @@ export default function Markdown({ message }: { message: string }) {
|
||||
code({ node, inline, className, children, ...props }) {
|
||||
const match = /language-(\w+)/.exec(className || "")
|
||||
return !inline ? (
|
||||
<CodeBlock
|
||||
language={match ? match[1] : ""}
|
||||
value={String(children).replace(/\n$/, "")}
|
||||
/>
|
||||
<CodeBlock
|
||||
language={match ? match[1] : ""}
|
||||
value={String(children).replace(/\n$/, "")}
|
||||
/>
|
||||
) : (
|
||||
<code className={`${className} font-semibold`} {...props}>
|
||||
{children}
|
||||
|
Loading…
x
Reference in New Issue
Block a user