Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

New line in basic card in google actions

I would like to have new line items in the basic card . Google's documentation states:

A limited subset of markdown is supported:
New line with a double space
*bold*
italics

I am able to get the bold and italics working but the new line is not working . I quite don't understand by the double space usage.

<br> works in the simulator but in real device it renders as <br>

Can someone help me in rendering multiple lines using the buildrich response ?

My code:

app.ask(app.buildRichResponse()
        .addSimpleResponse("Simple response")
        .addBasicCard(app.buildBasicCard('L1 L2 L3')
)
like image 652
rahulmr Avatar asked Jan 22 '18 09:01

rahulmr


2 Answers

Markdown requires that to force a line break, you need two spaces followed by a newline. So something like this in your code should work:

app.ask(app.buildRichResponse()
        .addSimpleResponse("Simple response")
        .addBasicCard(app.buildBasicCard("L1  \nL2  \nL3")
)

To be clear, that is <space><space><backslash><n>

like image 107
Prisoner Avatar answered Nov 23 '22 08:11

Prisoner


For me works a double space enclosed by a \n

\n  \n
like image 29
oschwarzpdm Avatar answered Nov 23 '22 10:11

oschwarzpdm