Marked.js - Trouble rendering

Marked.js - Trouble rendering
0

#1

Here’s my code so far: https://codepen.io/GiaFil/pen/rZKLXg

Links, code, images and bolded text render but not h1, h2, list items and blockquotes. I couldn’t find anything online, so I would appreciate it if someone could point out what is wrong with my code…

EDIT: I redid this with React and now in the preview I get HTML tags that are not parsed. What can I do to make this work?


#2

Use this:

<div id="preview" dangerouslySetInnerHTML={{ __html:marked(this.state.input) }}></div>

Also remove the marked wrapper around the input initial text and pay attention to the markdown syntaxis.


#3

I’m not exacty sure what in particular you’re referring to when you say:


#4

The first line, for example. You used “#Text” and it should be “# Text”.


#5

Wow! I didn’t think a spce would make the difference. One last thing: could you point out what’s wrong with my blockquote?


#6

Nothing wrong, you just need to give it some styles. If you inspect the output code with the developer tools you’ll see that the blockquote tag is already present inside the #preview div.


#7

You’re right. Turns out that I had forgotten to add a code block. Thank a lot for your help!