Markdown help needed

Hi all.
I’m ripping my hair out in frustration with markdown!
I’m reading all these pages that say typing either a trailing space and return or to use
. That doesn’t work for my page, immediately it stops rendering.
When I use a backlash () together with
at the start of each line it seems to work , okay, but it won’t render blockquotes or lists.

Heres’ my default markdown code:

const defaultValue = '# This is an `<h1>` tag  \n ## This is an `<h2>` tag \
<br/> <https://squeaksandnibbles.com/fancy-rats/> \
<br/>  \
<br/> ``` const getDate =() => {let date = new Date()}``` \
<br/> **bold** \
<br/>  \
<br/> > quote start \
<br/> > \
<br/> > quote end \
<br/> \
<br/> * list \
<br/> \
<br/> ![squirrel in field](https://pixabay.com/photos/chipmunk-spring-field-meadow-2323827/) \
';              

I added the spaces above the list and in between the quoteblock, which also wasn’t mentioned at every site , had too search many pages to find that mentioned.
Hope someone can help :slight_smile:
Thanks

Hello there, it is difficult to understand what the issue is, without seeing more code, or, preferably, your project.

Would you mind sharing a link to your project?

1 Like

I solved it myself . I wondered if it should have been backticks instead of ’ ’ surrounding the constant value , and that was it . Solved :slight_smile:

But thank you for the reply :slight_smile:

in case anyone is stuck with a similar problem,
today I realized that the backticks made a problem from the inline code.

That was solved like this:

`#  This is an  \`<h1>\`  tag  `;

source:

Soo frustrating , everything passes , except the last bonus test.
I tried using 2 spaces, a backlash, using <br> with escapeHtml set to false,
more than 2 spaces, I made sure the line break was within a block.
Why is it not working??! Maddening really :rage:

I have solved everything by myself and hate to ask for help , but I’m just at a loss. I’ve read a few different forum topics which dealt with issues with this :


I’ve readed marked.js docs, nothing is solving this.

Why??

I’m hoping to get some insight from someone.

Hi again,

It is difficult to help without seeing your code…otherwise, I might as well point you to other campers’ projects with the answer.

I hate posting it as I feel I should be able to do it on my own , but I’ve absolutely tried everything, it must be something very stupid that I’m overlooking:

not much CSS yet, just focusing on passing all tests atm :slight_smile:

Now I read here: https://marked.js.org/using_advanced

to set gfm to true and breaks to true , for <br> to work , still nothing??

I’m at a complete loss

Hey, no worries about asking for help. You have gotten so close.

Here is a hint:

  • You are not setting the options for marked here:
dangerouslySetInnerHTML={{__html:output,gfm:true,breaks:true}}

To be honest, I am surprised that does not break the output.

The document you listed shows how to set the options…

Hope this helps

1 Like

Thank you!! That solved it :grinning: Using setOptions instead , thank you again , I was wasting so much time with this & beginning to doubt myself