How import marked.js on CodePen

Tell us what’s happening:
Hello,
I try to make a MArkdown editor on CodePen with, React, Marked.js and Prism.js
I imported them frome preferences but my code say
Uncaught TypeError: marked is not a function
You can check My Code Here

Thanks

Your code so far

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36

Challenge: Build a Markdown Previewer

Link to the challenge:

Two things:

  • You don’t need to add import statements in your JS since you have added the libraries in the codepen JS settings. So get rid of those import statements at the top.
  • I believe you need to use an older version of marked to get this to pass the tests. Try using

https://cdnjs.cloudflare.com/ajax/libs/marked/2.0.3/marked.min.js

3 Likes

Read the docs for the marked lib. You have to use marked.parse()

1 Like

indeed with the old version it works thanks

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