New Line via Markdown and API

I am currently trying to create a note via API and trying to figure out, how to two line breaks. \n works for one. But \n\n does not create two. Using \\n\\n strangely creates a double line break but also leaves me with an extra backslash in the text. Using \n\\n or \\n\n does really weird things too. Just genuinely confused: How can I create a double line break? Oh: And <br> and <br /> didn't work either
8 Replies
ɃØĦɆᵾS
ɃØĦɆᵾS4mo ago
Just to be sure, you want to get this?
No description
El Odve
El Odve4mo ago
Hi @BigKahuna, I believe the notes are using markdown syntax for formatting? To add a new line in Markdown, the proper Markdown syntax is to end a line with two spaces followed by the enter key. This will introduce a line break but not paragraph change.
BigKahuna
BigKahunaOP4mo ago
That is correct But how to represent that carriage return via the API?
ɃØĦɆᵾS
ɃØĦɆᵾS4mo ago
I'm checking different options and it's weirdly processed, if I type test \n \ntest, in UI it shows no empty like between 2 paragraphs But when I change it on my own in UI, then API returns test\n\ntest (when this is used to create a new note, there's no empty line between 2 paragraphs) Looks like there's some kind of pre-processor which deletes additional whitespaces and newlines if there's no text between them @prastoin is Markdown processed by Blocknote?
El Odve
El Odve4mo ago
@BigKahuna just insert this programmatically in your raw text that you pass to the API. So for a newline instead of using just {end of sentence.\nNew line here.} you pass on {end of sentence. \nNew line here}.
ɃØĦɆᵾS
ɃØĦɆᵾS4mo ago
That will create only single newline instead of double I've tried different options like &nbsp;&nbsp;, <br /><br />, \n \n and others but it seems like markdown processor deletes them for some reason
El Odve
El Odve4mo ago
@BigKahuna : If even the double " \n \n" doesn't work then it sounds like black magic and I'm out of solutions... 🤷
BigKahuna
BigKahunaOP4mo ago
Had the same experience

Did you find this page helpful?