microsoft / microsoft/AdaptiveCards

[Authoring] Unable to render code within adaptive card

Open
#8,836 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-Schema Bug
Dominant language
C#
Stars
2k
Forks
595
Avg merge
1d 19h
Merged PRs (30d)
1

Description

Target Application

Teams

Application Operating System

Windows

Schema Version

1.5

Problem Description

I have the below adaptive card and it doesnt render the code correctly? When not using Adaptive Cards, teams is able to process this and render everything inside code block as code block.

Expected Outcome

Render the code block as code block

Actual Outcome

Code block is being rendered as regular text

Card JSON
{
    "type": "AdaptiveCard",
    "body": [
        {
            "type": "TextBlock",
            "text": "Sure! Here's an example of code to add two numbers in Python:\n\n\nnum1 = 5\nnum2 = 10\n\nsum = num1 + num2\n\nprint(\"The sum of\", num1, \"and\", num2, \"is:\", sum)\n\n\nThis code declares two variables `num1` and `num2` with values 5 and 10 respectively. It then adds the two numbers together and stores the result in the variable `sum`. Finally, it prints the sum to the console.",
            "wrap": true
        }
    ],
    "msteams": {
        "width": "Full"
    },
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.5"
}
Repro Steps

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by loading the supplied Adaptive Card JSON in Teams with schema 1.5 and compare its TextBlock rendering with the expected code-block formatting. Done means the embedded Python snippet renders as a code block rather than regular text, with the behavior verified in Teams.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.