#57 完了
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import ReactMarkdown from 'react-markdown'
|
||||
import { Link } from 'react-router-dom'
|
||||
|
||||
type Props = { body: string }
|
||||
|
||||
|
||||
export default ({ body }: Props) => (
|
||||
<ReactMarkdown components={{ a: (
|
||||
({ href, children }) => (['/', '.'].some (e => href?.startsWith (e))
|
||||
? <Link to={href!}>{children}</Link>
|
||||
: <a href={href} target="_blank" rel="noopener noreferrer">{children}</a>)) }}>
|
||||
{body}
|
||||
</ReactMarkdown>)
|
||||
Reference in New Issue
Block a user