diff --git a/src/components/CodeBlock.tsx b/src/components/CodeBlock.tsx new file mode 100644 index 0000000..972ed97 --- /dev/null +++ b/src/components/CodeBlock.tsx @@ -0,0 +1,21 @@ +import { useEffect, useRef } from "react" +import hljs from "highlight.js" +import "highlight.js/styles/atom-one-dark.css" // or any theme you prefer + +export default function CodeBlock({ children, className }) { + const codeRef = useRef(null) + + useEffect(() => { + if (codeRef.current) { + hljs.highlightElement(codeRef.current) + } + }, [children, className]) + + return ( +
+
+ {children}
+
+
+ )
+}
diff --git a/src/templates/Entry.tsx b/src/templates/Entry.tsx
index 0943dab..8e32e19 100644
--- a/src/templates/Entry.tsx
+++ b/src/templates/Entry.tsx
@@ -1,6 +1,88 @@
import { useParams } from "react-router"
import Page from "./Page"
+import { useQuery } from "@tanstack/react-query"
+import api from "@/api/eolas-api"
+import ReactMarkdown from "react-markdown"
+import remarkGfm from "remark-gfm"
+import CodeBlock from "@/components/CodeBlock"
+import remarkMath from "remark-math"
+import rehypeKatex from "rehype-katex"
+import "katex/dist/katex.min.css"
+
export default function Entry() {
const { entry } = useParams()
- return {children}
, + ul: ({ children }) =>+ {children} ++ ), + pre: ({ children }) => { + const child = children.props + return
+ {children}
+
+ ),
+ }}
+ >
+ {body}
+