Share code efficiently on Telegram

Loïc YabiliLoïc Yabili
2 min read

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

https://telegram.org/blog/supergroups

https://www.markdownguide.org/basic-syntax/

0
Subscribe to my newsletter

Read articles from Loïc Yabili directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Loïc Yabili
Loïc Yabili

I am a mobile software developer specializing in Flutter. I provide quality services to clients. In my journey I worked with 40+ satisfied clients across the world and successfully completed 70+ orders.