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
Just to be sure, you want to get this?

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.
That is correct
But how to represent that carriage return via the API?
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?@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}.
That will create only single newline instead of double
I've tried different options like
, <br /><br />, \n \n and others but it seems like markdown processor deletes them for some reason@BigKahuna : If even the double " \n \n" doesn't work then it sounds like black magic and I'm out of solutions... 🤷
Had the same experience