I'm trying to send a json string with markdown signs to an API.
If I'm sending the following string it works fine:"## Heading 2 \n * List item \n * List item"
But if I use the following string:
"## Heading 2 \n ## Heading 2 \n * List item \n * List item"
It will not work at all. The first \n just disappears and it makes a heading like:
Heading 2 ## Heading 2
What I need to achieve is this:
<p>A paragraph with some text.</p>
<h2>A heading</h2>
<ul>
<li> item 1 </li>
<li> item 1 </li>
</ul>
This is because you space characters after your new line characters, so the actual Markdown code is this:
## Heading 2
## Heading 2
* List item
* List item
How this is rendered depends a bit on your Markdown implementation, but it’s possible that there is some Markdown implementation that would add that second line after the heading on the first line.
You should remove those spaces to make sure that the code looks like this:
## Heading 2
## Heading 2
* List item
* List item
If that doesn’t work, try adding spaces between those segments:
## Heading 2
## Heading 2
* List item
* List item
Finally, if you want a paragraph before the heading, it should look like this:
A paragraph with some text.
## A heading
* item 1
* item 1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With