commons/client/src/components/atoms/Markdown.tsx

19 lines
446 B
TypeScript
Raw Normal View History

2019-04-08 15:59:02 +02:00
import React from 'react'
import ReactMarkdown from 'react-markdown'
2019-04-30 19:19:28 +02:00
const Markdown = ({
2019-04-08 15:59:02 +02:00
text,
className
}: {
text: string
className?: string
}) => {
// fix react-markdown \n transformation
// https://github.com/rexxars/react-markdown/issues/105#issuecomment-351585313
const textCleaned = text.replace(/\\n/g, '\n ')
return <ReactMarkdown source={textCleaned} className={className} />
}
2019-04-30 19:19:28 +02:00
export default Markdown