Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rich card properties markdown formatting

I have problem with markdown formatting of Text property in Hero card. Here is code sample:

HeroCard heroCard = new HeroCard()
{
    Text= $"**Place1**: Berlin \n\n**Place2**: Hamburg",
    Buttons = cardButtons
};

It doesn't make line brakes. Also tried \r\n, works neither. It looks like this:

enter image description here

How can I put text on the bottom of the hero card?

like image 923
Dusan Avatar asked Aug 09 '16 11:08

Dusan


People also ask

Does ms Teams support Markdown?

With Markdown, you get a live preview of your formatted text inside your compose box as you type, and you can always undo your formatting by pressing Ctrl+Z.

How do you mention an adaptive card?

To include a mention in an Adaptive Card, your app needs to include the following elements: <at>username</at> in the supported Adaptive Card elements. The mention object inside of an msteams property in the card content includes the Teams user ID of the user being mentioned.

What are Markdown elements?

The formatting elements specified by Markdown come in two basic types: there are block elements and inline elements. Block elements include such things as paragraphs of text, code blocks, block quotes, lists, and tables.

Which of the following is not a valid card type in Microsoft Teams?

Media elements are currently not supported in Adaptive Card on the Teams platform.


1 Answers

As already mentioned, this is down to both the channel (client - e.g. emulator, skype, facebook, your own directline client) implementing markdown support, since the text is sent as markdown in the json response.

However, at the moment you'll probably find that both the emulator and skype will render markdown on the message's "text" element but will ignore markdown on the attachment's "text" elements, e.g.

HeroCard heroCard = new HeroCard()
{
    Text= "Booo - no *markdown* supported here",
    Buttons = cardButtons
};

vs

var reply = activity.CreateReply("**Lovely lovely markdown**\n\n *yey!*");

var heroCard = new HeroCard()
{
    Text = "Booo - no *markdown* supported here",
    Buttons = cardButtons
};

reply.Attachments = new List<Attachment> {
  hero.ToAttachment()
};

I show a few examples of rich conversation cards here, and how they render on emulator vs skype desktop vs skype app va skype web, in case that helps.

like image 182
rposbo Avatar answered Oct 26 '22 21:10

rposbo