score:3

Accepted answer
import Markdown from 'react-markdown'
import remarkGfm from 'remark-gfm'

const content = `
  # Hello
  Please check out this tweet: https://twitter.com/adamwathan/status/1378480731651981322
`

export default Index() {
    return (
        <Markdown
            remarkPlugins={[remarkGfm]}
            components={{
                a: props => {
                    return props.href.startsWith('https://twitter.com') ? (
                        <CustomTwitterComponent url={props.href} /> // Render Twitter links with custom component
                    ) : (
                        <a href={props.href}>{props.children}</a> // All other links
                    )
                }
            }}
        >
            {content}
        </Markdown>
    )
}

Related Query

More Query from same tag