mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
23 lines
557 B
TypeScript
23 lines
557 B
TypeScript
import React, { ReactElement } from 'react'
|
|
import ReactMarkdown from 'react-markdown'
|
|
import styles from './Markdown.module.css'
|
|
|
|
const Markdown = ({
|
|
text,
|
|
className
|
|
}: {
|
|
text: string
|
|
className?: string
|
|
}): ReactElement => {
|
|
// fix react-markdown \n transformation
|
|
// https://github.com/rexxars/react-markdown/issues/105#issuecomment-351585313
|
|
const textCleaned = text?.replace(/\\n/g, '\n ')
|
|
return (
|
|
<ReactMarkdown className={`${styles.markdown} ${className}`}>
|
|
{textCleaned}
|
|
</ReactMarkdown>
|
|
)
|
|
}
|
|
|
|
export default Markdown
|