Markdown Previewer (React)

Hi guys,

I got a problem here. I could not passed 1 test, but seems like i could ge the correct result at preview window.

https://codepen.io/WongYC-66/full/mdzjOzM

Below is the failed test.

. When I enter GitHub flavored markdown into the #editor element, the text is rendered as HTML in the #preview element as I type (Hint: You don’t need to parse Markdown yourself - you can import the Marked library for this: https://cdnjs.com/libraries/marked)

#preview’s only children should be those rendered by marked.js : expected ‘

’ to equal ‘’

I don’t think the tests like that you are putting the rendered HTML inside an extra div:

return <div dangerouslySetInnerHTML={markup}></div>;

I think the rendered HTML should go directly inside of the #preview div.

Solved.

Thank you for the enlightening. again. Mr bbsmooth :blush:

1 Like

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