This article explains how to send pre-formatted text via a Telegram message on Windows or macOS.
Steps

Step 1. Copy the code you want to send
To do this, select it within the file or application it is in, then press Ctrl + C (Windows) or ⌘ Cmd + C (macOS).

Step 2. Open Telegram
If you use Windows, you will find it in the menu
. If you have macOS, you should find it in the "Applications" folder.

Step 3. Click on the contact you want to send the pre-formatted text to
A conversation with this user will open.

Step 4. Click the Write a message box
It's at the bottom of the conversation.

Step 5. Type `` `
There is no need to add spaces. To keep the text in an easy-to-read format, you need to insert 3 "` "(grave accents) at the beginning and at the end.

Step 6. Press Ctrl + V (Windows) or ⌘ Cmd + V (macOS).
This way the text you copied will be pasted into the typing field.

Step 7. Type `` `
At this point you should have 3 grave accents both at the beginning and at the end of the preformatted text.

Step 8. Press Enter
The code will thus appear in the conversation maintaining the original format.