7

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')
)
Prisoner
  • 49,922
  • 7
  • 53
  • 105
rahulmr
  • 681
  • 1
  • 7
  • 19

4 Answers4

10

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>

Prisoner
  • 49,922
  • 7
  • 53
  • 105
9

For me works a double space enclosed by a \n

\n  \n
oschwarzpdm
  • 174
  • 10
2

A limited subset of markdown is supported in google actions:

A new line with a double space like you content \n(content with the newline)

for bold **bold**

and for italic *italics*

Jay Patel
  • 2,341
  • 2
  • 22
  • 43
2

Following are steps to make the text for the new line in dialogflow basic card :

1.Enter your text

2.give two spaces

3.then, (SHIFT+ENTER)

Follow the same step for every text line.