Send code snippets in a message in Microsoft Teams
To send a code snippet in a chat or channel message:
-
Select Format below the message box.
-
Choose Code snippet to open a dialog box.
-
In the dialog box, enter the code along with a title for the snippet. Select the check box if you want your text to wrap, and then select the pull-down menu to choose the language that you want to use.
-
Select Cancel or Insert to add the snippet to your message.
Syntax highlighting and auto-indentation help you to write your code the way you want. When you send your snippet, it’s included in the message as a card, and the recipient can view it inline with the syntax highlighting intact.
To edit your code snippet after you’ve sent it, select More options > Edit on your message, then Edit again on the snippet card.