botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

HeroCard: can not break line in HeroCard.text

Open astrung opened this issue 10 years ago • 27 comments

How can i break line in text of HeroCard ? I try by "\n" or by "\n\n" , but nothing helps

astrung avatar Oct 15 '16 15:10 astrung

Which channel are you using? Do you see the same behavior in the Emulator?

danmarshall avatar Oct 17 '16 17:10 danmarshall

@astrung HeroCard text support markdown paragraphs. So try it with "\n" for a simple break line or "\n\n" to create a new paragraph.

Here you can see the documentation: https://docs.botframework.com/en-us/csharp/builder/sdkreference/activities.html

reyesrico avatar Oct 17 '16 22:10 reyesrico

On bot facebook and emulator channel, it doesn't work

astrung avatar Oct 18 '16 12:10 astrung

No one help me :( ? I am still waiting . Example: var card = new builder.HeroCard() .title("name") .subtitle("address") .text("Product:"+ myValue +"\n\n"+"Language:" + Array.join(", "))

astrung avatar Oct 24 '16 09:10 astrung

Can you try string builder... StringBuilder str = new StringBuilder(); str.AppendLine("Welcome"); str.AppendLine(); str.AppendLine("to ");

and assign this to hero card....

ravipulluri avatar Oct 24 '16 12:10 ravipulluri

How can i find StringBuilder in node js library ?

astrung avatar Oct 26 '16 04:10 astrung

can you check this https://www.npmjs.com/package/stringbuilder

ravipulluri avatar Oct 26 '16 05:10 ravipulluri

I thought your solution is in .Net

Best Regards, Ravi Pulluri. Sent from my Windows Phone


From: astrungmailto:[email protected] Sent: ‎10/‎26/‎2016 9:37 AM To: Microsoft/BotBuildermailto:[email protected] Cc: Ravi Pullurimailto:[email protected]; Commentmailto:[email protected] Subject: Re: [Microsoft/BotBuilder] HeroCard: can not break line in HeroCard.text (#1439)

How can i find StringBuilder in node js library ?

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/Microsoft/BotBuilder/issues/1439#issuecomment-256244486, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AAY_W1TWZ6QK_h5HG_YnfzEp2Cw0ugGYks5q3tHlgaJpZM4KXuqT.

ravipulluri avatar Oct 26 '16 15:10 ravipulluri

Bot framework channel is broken when send my card in nodejs with stringbuilder library:

    var StringBuilder = require('stringbuilder');
    var str = new StringBuilder();
    str.appendLine("Welcome");
    str.appendLine();
    str.appendLine("to ");
    var card = new builder.HeroCard()
      .text(str)

astrung avatar Oct 27 '16 02:10 astrung

You are mixing two systems.

Technically the herocard attachment replaces the text with a rich card. You should fill out the title, subtitle, etc fields the way that you want.

tomlm avatar Nov 05 '16 16:11 tomlm

Closing due to age. We just released a much improved emulator and the markdown should work. If not, please let us know.

chrimc62 avatar Nov 27 '16 00:11 chrimc62

Hi, I am having the same problem. Markup works for the normal messages sent back to the user, but doesn't work for the text on a HeroCard. StringBuilder also doesn't work. This is using the emulator. Thanks, Pieter

pvanaarde avatar May 15 '17 00:05 pvanaarde

@chrimc62 "\n" or "\n\n" does not work on webchat still.

mohit-jcc avatar Jul 04 '17 12:07 mohit-jcc

Does the Cortana channel not support the markdown text format?

swatibhartiya avatar Jul 06 '17 00:07 swatibhartiya

If you need advanced card formatting options, use Adaptive Cards instead of the Hero Card template.

nwhitmont avatar Jul 07 '17 19:07 nwhitmont

We are fixing the breaks in WebChat and Adaptive Cards.

reyesrico avatar Jul 10 '17 19:07 reyesrico

duplicate of #2583

nwhitmont avatar Jul 11 '17 01:07 nwhitmont

@nwhitmont prod is now being pushed. Can you please verify if it is solved?

reyesrico avatar Jul 20 '17 21:07 reyesrico

@reyesrico Ill take a look

JasonSowers avatar Jul 20 '17 21:07 JasonSowers

I was able to confirm this is working in web chat with the following code:

                HeroCard plCard = new HeroCard()
                    {
                         Title = $"I'm \r\r a hero \n\r card",
                         Subtitle = $" Wikipedia \r\r Page \n\r test",
                         Text = "line 1 \r\r line 2 \n\r line 3 \r line 4"
                     };

This snippet was rendered as this in emulator: image

JasonSowers avatar Jul 20 '17 22:07 JasonSowers