Variable with line-breaks
Hi, when I put a text into a variable with line-breaks, it´s not working when showing into bubble block. I have tried with '\n' as well but no look. Is there some workaround?
For sample: myvar='text1
text2
...
text3'
8 Replies
Try this syntax:
myvay = 'text1\ntext2'
Hi, I tried with myvar=return "- Ortopedia:\nSegunda a Sexta-feira: das 07h às 19h\nSábados: das 07h às 13h\n- Fisioterapia:\nSegunda a Sexta-feira: das 07h às 19h\nSábados: das 07h às 13h" but the http ap is eating some '\n' on backend. I am receving:
"children": [
{
"type": "ul",
"children": [
{
"type": "li",
"children": [
{
"type": "lic",
"children": [
{
"bold": true,
"text": "Ortopedia:\nSegunda a Sexta-feira: das 07h às 19h\nSábados: das 07h às 13h"
}
]
}
]
},
{
"type": "li",
"children": [
{
"type": "lic",
"children": [
{
"bold": true,
"text": "Fisioterapia:\nSegunda a Sexta-feira: das 07h às 19h\nSábados: das 07h às 13h"
}
]
}
]
}
]
}
]
The trailing '\n' in the 'Sábados: das 07h às 13h\n- Fisioterapia:' is getting rid off
Here is the screen capture fter I send to whatsapp
![No description](https://cdn.answeroverflow.com/1190403834015662131/image.png)
That’s expected since it is another rich text list child, the new lines between list items are “ignored”
OK, thank you @Baptiste . But, How can I put a linebreak into this string myvar=return "- Ortopedia:\nSegunda a Sexta-feira: das 07h às 19h\nSábados: das 07h às 13h\n- Fisioterapia:\nSegunda a Sexta-feira: das 07h às 19h\nSábados: das 07h às 13h"?
I need to put a linebreak before '- Fisioterapia:', but it´s ignored when I receive the http api results. And, the '-' is also ignored as well.
The markdown syntax is transformed into a rich text object.
The “-“ are replaced by the “li” type which means “list item”
Thank you. I modified my parse to handle it