aboutsummaryrefslogtreecommitdiff
path: root/src/pages/Post.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/pages/Post.tsx')
-rw-r--r--src/pages/Post.tsx19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/pages/Post.tsx b/src/pages/Post.tsx
index 67f8959..5c0f0ca 100644
--- a/src/pages/Post.tsx
+++ b/src/pages/Post.tsx
@@ -1,4 +1,6 @@
import { useParams, Link } from "react-router-dom";
+import CodeSnippet from "../components/CodeSnippet";
+import LinkWithIcon from "../components/LinkWithIcon";
import NotFoundPage from "./404Page";
interface PostFile {
@@ -27,7 +29,7 @@ export default function Post() {
return (
<article className="prose prose-zinc dark:prose-invert mx-auto px-4 py-10">
- <Link to="/blog" className="no-underline hover:underline">
+ <Link to="/blog" className="no-underline">
← Back
</Link>
@@ -44,7 +46,20 @@ export default function Post() {
{new Date(meta.date).toLocaleDateString("de-DE")}
</p>
- <Content />
+ {/* The Markdown, already a React component */}
+ <Content
+ components={{
+ code({ children }: any) {
+ return (
+ <CodeSnippet
+ code={String(children).replace(/\n$/, "")}
+ initialLines={5}
+ />
+ );
+ },
+ a: LinkWithIcon,
+ }}
+ />
</article>
);
} \ No newline at end of file