tdesktop icon indicating copy to clipboard operation
tdesktop copied to clipboard

Automatically Syntax-Highlight received Code

Open leolabs opened this issue 9 years ago • 126 comments

It would be great if we were able to send code snippets via Telegram in a way that is nicely readable by the receiver. I'm chatting a lot with other developers and often, I feel the need for such a feature.

Related issue on the Telegram bug tracker: https://bugs.telegram.org/c/824

leolabs avatar Nov 10 '14 23:11 leolabs

Also, support for GitHub's Markdown would be a wise feature.

sigod avatar Nov 10 '14 23:11 sigod

Code highlighting, or at least tabulation, would be awesome

animalillo avatar Nov 11 '14 07:11 animalillo

The thing is, highlighted code doesn't have to be a new message format like images or videos as it's also just text. It could be marked like code in GitHub flavoured Markdown using three backticks or something like that.

leolabs avatar Nov 11 '14 14:11 leolabs

or just by using some library that detects most common programming structures, there is probably some library made to detect code inserted between text

animalillo avatar Nov 11 '14 14:11 animalillo

I'll also appreciate this !


code here

will be a nice addition

bararchy avatar Dec 10 '14 10:12 bararchy

I like the idea. I'm waiting for later versions of Telegram to see whether I need Kik Messenger installed on my phone or not. Please keep doing well developers.

meness avatar Dec 16 '14 06:12 meness

I absolutely agree. Syntax highlighting is very useful thing

HallEffect avatar Mar 03 '15 09:03 HallEffect

I disagree about automatic mode. Should be some markup language like [code]int main()...[/code] instead of automatic to avoid bugs and excessive CPU consumption on parsing messages.

ezdev128 avatar Mar 03 '15 09:03 ezdev128

Nice Feature, Like that ;)

avestura avatar Mar 14 '15 12:03 avestura

I would love that support! A markdown support as in GitHub or on HabitRPG's chat would solve well the problem about a non-dev sending a sample message and te app reading it as source code.

Ziul avatar Jun 13 '15 23:06 Ziul

I know telegram is a mobile-first application, but we already have this kind of functionality in other chat tools like slack that use it in both mobile and desktop implementation. This kind of markdown language would really help telegram to be adopted by technical teams on internal communication. I am trying to convince my team to replace slack and skype by telegram and this feature would help me a lot on this task! Keep doing this great work!

andrecamposgm avatar Aug 12 '15 18:08 andrecamposgm

@GreatMedivack you just had to be different to everone else :arrow_up:

joeldrapper avatar Oct 06 '15 13:10 joeldrapper

+1 from me and +1 from my cat

brawaru avatar Oct 06 '15 14:10 brawaru

What would be the best way to handle this? Slack does code highlighting, but its not markdown style, rather code upload. UX matters too.

lawrencegs avatar Nov 01 '15 05:11 lawrencegs

+1 for the same system as Github, backticks with the language code behind, would be super useful

pascalchevrel avatar Nov 14 '15 12:11 pascalchevrel

This was implemented, check this out: image

Inline `code` has `back-ticks around` it.
```
var s = "Block highlighting";
alert(s);
```

lopezjurip avatar Nov 26 '15 18:11 lopezjurip

This is just the monospace, not Syntax-Highlight. And if a line have more than 51 characters, it breaks the line (if was even the 80 chars i would understand...but why 51?). And the mobile still not working well. If the feature is already implemented, it need some improves.

Ziul avatar Nov 26 '15 20:11 Ziul

+1 highlight syntax like in gitter

bskydive avatar Dec 10 '15 20:12 bskydive

It's worth noting that it's now possible to format code blocks by using the @bold bot which accepts markdown.

joeldrapper avatar Jan 10 '16 21:01 joeldrapper

@joeldrapper @bold didn't support syntax highlighting and use word breaking to separate line. It's makes code more unreadable if you send some example to man for showing some example, it's hard to read and still better sending code with pastebin. It's needs horizontal scroll at minimum, but i don't know, support it's telegram or not.

Niklan avatar Jan 11 '16 03:01 Niklan

@Niklan Currently TDesktop does not support horizontal scroll in messages layout :(

telegramdesktop avatar Jan 11 '16 04:01 telegramdesktop

Has no way to embed Pastebins links? However, a native option will be great.

theus avatar Jan 13 '16 13:01 theus

If inline-bot is the preferred ways for bold & italic... then we will probably have to resort to inline-bot for this "programmer only" case?

lawrencegs avatar Jan 13 '16 14:01 lawrencegs

@lawrencegs Could be inline-bots a way to do this, but the API don't have a implement to modify colors in text. It has only a simple markdown.

theus avatar Jan 13 '16 14:01 theus

I love the ``` block and I use it a lot, but syntax highlighting will be a new level.

haimn avatar Mar 01 '16 23:03 haimn

Well, I'm upping this since it would be really lovely and useful :+1:

Shahor avatar Mar 08 '16 13:03 Shahor

@Niklan Indeed, we need resizable chat width at least. I commented about it here: https://github.com/telegramdesktop/tdesktop/issues/1634#issuecomment-194929183

kirsan31 avatar Mar 10 '16 16:03 kirsan31

Use the new reactions of GitHub on the first entry of this issue instead of creating unnecessary +1 comments.

auchri avatar Mar 23 '16 20:03 auchri

Reactions aren't available in mobile site yet.

stek29 avatar Mar 23 '16 22:03 stek29

@stek29 I know - but you can easily switch to the desktop version.

auchri avatar Mar 23 '16 23:03 auchri