Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trello API: Programatically Adding Line Breaks to Card Descriptions

When manually entering a Trello card's description, it's easy to introduce line breaks: just press ENTER. However, I need to introduce line breaks when setting a card's description via the Trello API. So far, \n and < br > don't get parsed. Any ideas?

like image 997
filmnut Avatar asked Feb 21 '14 15:02

filmnut


2 Answers

If you happen to find this and are looking to add a line break using the URL from the API, use %0A.

For example:

https://api.trello.com/1/cards?key=(key)&token=(token)&name=(card name)&desc=Line 1 %0A Line 2 %0A Line 3&idList=<id>
like image 130
James Avatar answered Sep 30 '22 20:09

James


Struggled with this problem for ages. The php in WisdmLabs' answer works if it's passed as php to an element and then to js through getElementByID, but that's not possible if you need to set the variable clientside.

Finally found \x0A works in js.

Hope this saves someone from the hours of googling I endured!

like image 29
Faye Avatar answered Sep 30 '22 19:09

Faye