From d2ce6bb4185e773aefc71fd916a491a78acaef09 Mon Sep 17 00:00:00 2001 From: highperfocused Date: Sun, 5 Oct 2025 20:42:15 +0200 Subject: [PATCH] Enhance Markdown rendering with custom heading styles and add typography plugin to Tailwind CSS --- src/components/MarkdownContent.tsx | 33 +++++++++++++++++++++++++++++- tailwind.config.ts | 3 ++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/components/MarkdownContent.tsx b/src/components/MarkdownContent.tsx index 7ece0e7..77c9e28 100644 --- a/src/components/MarkdownContent.tsx +++ b/src/components/MarkdownContent.tsx @@ -15,10 +15,41 @@ interface MarkdownContentProps { */ export function MarkdownContent({ content, className }: MarkdownContentProps) { return ( -
+
( +

+ {children} +

+ ), + h2: ({ node, children, ...props }) => ( +

+ {children} +

+ ), + h3: ({ node, children, ...props }) => ( +

+ {children} +

+ ), + h4: ({ node, children, ...props }) => ( +

+ {children} +

+ ), + h5: ({ node, children, ...props }) => ( +
+ {children} +
+ ), + h6: ({ node, children, ...props }) => ( +
+ {children} +
+ ), // Custom link renderer to handle nostr: URIs a: ({ node, href, children, ...props }) => { // Handle nostr: URIs diff --git a/tailwind.config.ts b/tailwind.config.ts index 8ff2536..07a1799 100644 --- a/tailwind.config.ts +++ b/tailwind.config.ts @@ -1,5 +1,6 @@ import type { Config } from "tailwindcss"; import tailwindcssAnimate from "tailwindcss-animate"; +import typography from "@tailwindcss/typography"; export default { darkMode: ["class"], @@ -93,5 +94,5 @@ export default { } } }, - plugins: [tailwindcssAnimate], + plugins: [tailwindcssAnimate, typography], } satisfies Config;