Test failing for markdown previewer. But, it functions as specified

I hope you guys aren’t getting tired of me. I’ve had to post so much lately over this one little project.

Finally got it up and running on github pages thanks to lasjorg.

But, now it’s failing tests that it should be passing. I mean, it does what the test is asking for… just maybe not in a way that’s expected by the tests?

What do I do?

Are you updating on keyup events, as specified, or something else? Could you provide a link to your source code?

Whoops. I posted it so often recently and forgot to add it here. My apologies.

The problem is likely that I am not using “marked” for the markdown because the moment I looked it up I found out that it shouldn’t be used at all because of the “dangerouslySetInnerHTML” thing, which I know nothing about other than to avoid it.

So, I used the most popular one, react-markdown. Maybe FCC just hasn’t updated their test suite in awhile?

I have no idea how the react-markdown component is dealing with keyup.

Here’s what it says in their info:

Made with react-markdown

react-markdown is a markdown component for React.

:point_right: Changes are re-rendered as you type.

:point_left: Try writing some markdown on the left.

Overview

  • Follows CommonMark
  • Optionally follows GitHub Flavored Markdown
  • Renders actual React elements instead of using dangerouslySetInnerHTML
  • Lets you define your own components (to render MyHeading instead of h1)
  • Has a lot of plugins

I was thinking how strange it is that there is so little information about each React component on https://www.npmjs.com when I remembered something lasjorg said about looking in the node_modules folder. I found the react-markdown folder and looked all around for anything useful. Nothing.

This is getting weird. When I was learning about SwiftUI it was like this too… kind of mysterious and hard to just go look things up when you need to.

Anyone know anything about that? Maybe I just don’t know where to look yet.

Did I ask the question wrong or something? Maybe everyone’s busy too. I couldn’t even get back to check on this for about a week. But, no replies in all that time. Hmm

Ya, there is a chance that the tests do not work properly with the react-markdown component. I think using that component might perhaps violate the “spirit” of the challenge. I’m not saying you are cheating in any way. The rules don’t necessarily appear to prohibit it. But I think the intention was to have you create the markdown editor and previewer yourself instead of just adding one with react-markdown.

So if you want to pass all of the tests then you might need to ditch react-markdown and go with the marked library instead.