/** * Copyright (c) 2023-present Plane Software, Inc. and contributors * SPDX-License-Identifier: AGPL-3.0-only * See the LICENSE file for details. */ import React from "react"; import ReactMarkdown from "react-markdown"; interface CustomComponentProps { href: string; children: React.ReactNode; } type CustomComponent = React.ComponentType; interface Props { markdown: string; components?: { a?: CustomComponent; blockquote?: CustomComponent; code?: CustomComponent; del?: CustomComponent; em?: CustomComponent; heading?: CustomComponent; hr?: CustomComponent; image?: CustomComponent; inlineCode?: CustomComponent; link?: CustomComponent; list?: CustomComponent; listItem?: CustomComponent; paragraph?: CustomComponent; strong?: CustomComponent; table?: CustomComponent; tableCell?: CustomComponent; tableHead?: CustomComponent; tableRow?: CustomComponent; }; options?: any; } function HeadingPrimary({ children }: { children: React.ReactNode }) { return

{children}

; } function HeadingSecondary({ children }: { children: React.ReactNode }) { return

{children}

; } function Paragraph({ children }: { children: React.ReactNode }) { return

{children}

; } function OrderedList({ children }: { children: React.ReactNode }) { return
    {children}
; } function UnorderedList({ children }: { children: React.ReactNode }) { return ; } function Link({ href, children }: CustomComponentProps) { return ( {children} ); } export function MarkdownRenderer({ markdown, options = {} }: Props) { const customComponents = { h1: HeadingPrimary, h3: HeadingSecondary, p: Paragraph, ol: OrderedList, ul: UnorderedList, a: Link, }; return ( {markdown} ); }