import type { Components } from "react-markdown"; import { NostrEntity } from "./NostrEmbeds"; // Shared markdown renderers for blog article bodies. The `remarkNostr` plugin // rewrites NIP-27 `nostr:` references into links with that scheme, which the // `a` renderer below swaps for live profile/note embeds. export const markdownComponents: Components = { h1: ({ children }) => (
{children}
), a: ({ href, children }) => { if (href?.startsWith("nostr:")) { return{children}), code: ({ className, children }) => { const isBlock = className?.includes("language-"); if (isBlock) { return (
{children}
);
}
return (
{children}
);
},
pre: ({ children }) => (
{children}
),
img: ({ src, alt }) => (