Skip to content

Parsing links in markdown and use next/link #17088

Answered by laugharn
gabriel-ortiz asked this question in Help
Discussion options

You must be logged in to vote

You can define a renderers object as a ReactMarkdown prop, which should give you a little more control over the link:

<ReactMarkdown
  renderers={{
    link: ({ children, href }) => {
      return <Link href={href}><a>{children}</a></Link>
    }
  }}
/>

Edited to fix the example code

Replies: 5 comments 6 replies

Comment options

You must be logged in to vote
5 replies
@gabriel-ortiz
Comment options

@laugharn
Comment options

@sodhisaab
Comment options

@sodhisaab
Comment options

@sodhisaab
Comment options

Answer selected by gabriel-ortiz
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@deniapps
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
8 participants