MicrosoftDocs / msteams-docs

Source for the Microsoft Teams developer platform documentation.
https://aka.ms/teamsdev
Creative Commons Attribution 4.0 International
276 stars 501 forks source link

Inconsistent handling of newlines in markdown in adaptive cards #4758

Open matthiasdilger opened 2 years ago

matthiasdilger commented 2 years ago

According to the documentation, \n\n should be used when adding a newline in markdown text in a TextBlock in an adaptive card.

Example card:

{
        "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
        "type": "AdaptiveCard",
        "version": "1.2",
        "body": [
         {
            "type": "TextBlock",
            "text": "<at>User</a> Your package will arrive on {{DATE(2017-02-14T06:00:00Z, SHORT)}} at {{TIME(2017-02-14T06:00:00Z)}}",
            "wrap": true
        },
          {            
            "type": "TextBlock",
            "text": "**bold**\n\n_cursive_",
            "wrap": true             
          }
        ],
        "msteams": {
          "entities": userAboveMentioned,
          "width": "Full"
        }
      }

The bot sends this card with a mention to a group chat and the mentioned User opens client: Works fine on desktop and web, \n\n = 1 newline Android: \n\n = 2 newlines iOS: \n\n = 0 newlines, needs \r\n and the user mention completely breaks rendering the card (date function and markdown shown in raw text) (see https://github.com/MicrosoftDocs/msteams-docs/issues/4253)

The bot sends this card with a mention to a channel (creates a new conversation using adapter.createConversation): Desktop, web and Android: \n\n = 2 newlines iOS: \n\n = 0 newlines, needs \r\n and the user mention completely breaks rendering the card (date function and markdown shown in raw text) (see https://github.com/MicrosoftDocs/msteams-docs/issues/4253)

Solution: Please make \n\n work the same everywhere


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

ghost commented 2 years ago

Hi matthiasdilger! Thank you for bringing this issue to our attention. We will investigate and if we require further information we will reach out in one business day. Please use this link to escalate if you don't get replies.

Best regards, Teams Platform

sayali-MSFT commented 2 years ago

@matthiasdilger - We are looking into this I will get back to you soon.

eggry commented 2 years ago

Having the same issue. So far, \r\r will produce consistent line break across platform (iOS/Android/PC/Web), you can use that as a workaround.

Meghana-MSFT commented 2 years ago

@matthiasdilger - We were able to repro this issue. We have raised a bug for the same.

matthiasdilger commented 2 years ago

@Meghana-MSFT It works better now on desktop and web and also iOS has improved slightly but Android still has the issue of \n\n in markdown TextBlocks causing too many newlines. It would be great if this could be fixed.