Build a Markdown Previewer: default markdown

Build a Markdown Previewer: default markdown
0

#1

Hi can someone help find why my default markdown is not working please here is the pen:?

https://codepen.io/thierved/pen/bKbaWw?editors=0010


#2

It’s because marked treats indentation as significant and space is also significant in string template literals. Therefore, this works:

marked(`
## This is a sub-heading...
`);

And this doesn’t:

marked(`
        ## This is a sub-heading...
`);

I hope that helps!

EDIT: Technically speaking both work because it’s what marked is expected to do, it’s just that your expectations are different.


#3

thank you, for the help !