Preview Window Only Shows BG Color

Hello, I’m currently working on the Marked Down project and while working, the preview window on the bottom stopped showing what I’d done. I don’t know what I did or where I went wrong to make do this.

Here’s a link to my project:

Use the parse method.

marked.parse(text);

Make sure to read the docs.

https://marked.js.org/

I don’t understand. Is there only one spot that I need to make changes or is what I have not going to work? What was wrong with the stuff I already had?

I assume you looked at the example project code? It is using an older version of the lib.

You now have to use the parse method when adding the lib as a script (which is what using the settings to add the script does).

4.0.0 (2021-11-02)

  • When using marked in a script tag use marked.parse(...) instead of marked(...)

So like so:

const markdown = marked.parse(text);

Otherwise, you can use an import at the top:

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

And keep your code as it is now using just marked (without .parse). Just remember to remove the lib from the settings if you do it like that.

Ah, I see now. I got confused more a minute. I change it to the marked.parse(text) and it fixed everything. Thank you!

1 Like