Markdown Previewer / 'react-markdown' instead of 'marked'

Could somebody advice on how to pass the last test in " Build a Markdown Previewer " project :
Optional Bonus (you do not need to make this test pass): My markdown previewer interprets carriage returns and renders them as br (line break) elements.
I’m using ‘react-markdown’ instead of ‘marked’.

Maybe try this?

This is a configurable option in marked, hence the extra test, but it’s not guaranteed to exist in any other markdown processor. That is probably why the requirement is optional.

You could also try writing your own preprocessor to find carriage returns and turn them into <br> before processing the string with react-markdown.

Thanks, I already rewrote the code and used “marked” to pass all tests.

<ReactMarkdown id="preview/>


  breaks: true,


<div id="preview"  dangerouslySetInnerHTML={{
      __html: marked(markdown)
1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.