Markdown Previewer solution fails Tests 5 and 6 despite functioning as intended

Hey all,

So my solution to the Markdown Previewer project returns results similar to the example app provided by the assignment, yet the test suite returns fails for tests 5 and 6.

Test 5 Fail:

write some markdown representing an <h1> : expected false to be true

Test 6 Fail;

#preview does not contain at least one <a> : expected 0 to be at least 1

Inspecting my #preview element using the browser’s inspector reveals that the parser did parse my default Markdown string correctly, and there are both <h1> and <a> elements in the #preview element. So I’m not sure what’s going on.

This is my solution so far (CodePen). Haven’t gotten to the styling yet, of course.

Challenge: Build a Markdown Previewer

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0

3 Likes

Edit: Quick update. We know what is wrong with the tests and they are getting fixed, hopefully soon. After the fix has landed the markedjs library should work again when using the Codepen settings or a script element to load the library. But until then keep using import.


The library has been updated and you now have to use import for Codepen.

Import it at the top of the JS like this.

import { marked } from "https://cdn.skypack.dev/marked@4.0.0";

And remove the script from the JS section in the settings.


As an aside, whenever you see a library bump the major version number, in this case going from 3.x.x to 4.x.x you always have to look for breaking changes. Major version bumps most often imply breaking changes.

releases notes: 4.0.0 (2021-11-02)

6 Likes

Thank you very very much. I didn’t know how to ask correctly about the same issue and I didn’t get a reply. But in this post I learned how I should’ve asked this question and your answer helped me solving the issue. In my case I preferred to go back to a previous version of the library.

1 Like

Thank you so much! Man, what are the odds a build release would happen right before I tried to submit this assignment…

1 Like

That is frontend dev for you, it keeps you on your toes.

It is also why package managers use Semantic Versioning and lock files.

1 Like

Thanks a million for this!

Thank you so much. I was having the exact same problem and have been searching on the forums all day to try to find out why the tests kept failing! Is there a way of pinning this solution somewhere on the assignment page? Or making some kind of warning? I saw a lot of posts asking the same question but this is the only solution I found that worked.

I made a PR for this that should hopefully fix the issue.

Until we have a fix for this people will have to keep using import or switch back to using an older version of markedjs (V3 and below).