Telegram is a multi-platform messaging application that have more than 700 million active users in 2023.
Telegram and developers
Over time, Telegram has become one of the most popular messaging applications among developers, particularly thanks to its multiple features.
For example, supergroups can support several members, it is possible for administrators to subdivide the supergroup into several topics which allows to have a forum system directly on Telegram for the pleasure of developers 😊.
Share code on Telegram
To share the code on Telegram, you could copy your code and paste it directly into Telegram. Let's see what happens 🤔
Nothing special, the code is sent as a text message. If the code is long, visually it can be quite boring for a developer to read.
Telegram uses some Markdown code which is a markup language used to format text like in README files on GitHub for example.
Not all markdown codes are supported by Telegram, learn more here.
To send your code, you can put it within the following characters: "```" at the beginning and end of your code snippet.
```
System.out.println("Bonjour le monde");
```
Output:
We clearly have a better visual of our code but it is still possible to do better.
It is possible to color the code snippet; for this, you must specify the programming language you are using.
Here is how you can do it:
```php
<?php
//php
echo "Bonjour le monde";
?>
```
```dart
// Dart
print("Bonjour le monde");
```
```java
// Java
System.out.println("Bonjour le monde");
```
The result is just stunning 😍
Telegram code snippet
On the desktop application, it is even possible to copy the code snippet with a simple click.
Limitations
I noticed two limitations:
Putting two different pieces of code in a single message is impossible. When you do this the second piece of code will not be formatted.
Code formatting may not be supported on some devices. Like here on an iPhone 7:
Conclusion
Telegram offers several features that can be useful for developers, so make the most of them.
References
https://sendpulse.com/blog/telegram-text-formatting