Files
supabase/apps/studio/components/interfaces/Markdown.tsx
T
Joshen Lim fca9b3bff8 Feat/support expanding text cells into a sidepanel editor (#20727)
* Do up logic for callback for opening side panel

* Add TextEditor side panel and fix some quirky bugs with JSONEditor too

* Add Markdown Preview in TextEditor

* Fix bad cs

* Fix border css
2024-01-25 17:47:36 +07:00

30 lines
781 B
TypeScript

import { ReactMarkdown, ReactMarkdownOptions } from 'react-markdown/lib/react-markdown'
import { cn } from 'ui'
interface Props extends Omit<ReactMarkdownOptions, 'children' | 'node'> {
className?: string
content: string
extLinks?: boolean
}
const Markdown = ({ className, content = '', extLinks = false, ...props }: Props) => {
return (
<ReactMarkdown
components={{
h3: ({ children }) => <h3 className="mb-1">{children}</h3>,
a: ({ href, children }) => (
<a href={href} target={extLinks ? '_blank' : ''} rel={extLinks ? 'noreferrer' : ''}>
{children}
</a>
),
}}
{...props}
className={cn('prose text-sm', className)}
>
{content}
</ReactMarkdown>
)
}
export { Markdown }