telegramdesktop / tdesktop

Telegram Desktop messaging app
https://desktop.telegram.org/
Other
26.26k stars 5.22k forks source link

Automatically Syntax-Highlight received Code #250

Closed leolabs closed 1 year ago

leolabs commented 9 years ago

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

sigod commented 9 years ago

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

animalillo commented 9 years ago

Code highlighting, or at least tabulation, would be awesome

leolabs commented 9 years ago

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.

animalillo commented 9 years ago

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

bararchy commented 9 years ago

I'll also appreciate this !


code here

will be a nice addition

meness commented 9 years ago

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.

HallEffect commented 9 years ago

I absolutely agree. Syntax highlighting is very useful thing

ezdev128 commented 9 years ago

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.

avestura commented 9 years ago

Nice Feature, Like that ;)

Ziul commented 9 years ago

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.

andrecamposgm commented 9 years ago

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!

joeldrapper commented 9 years ago

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

brawaru commented 9 years ago

+1 from me and +1 from my cat

lawrencegs commented 9 years ago

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

pascalchevrel commented 8 years ago

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

lopezjurip commented 8 years ago

This was implemented, check this out: image

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

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.

bskydive commented 8 years ago

+1 highlight syntax like in gitter

joeldrapper commented 8 years ago

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

Niklan commented 8 years ago

@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.

telegramdesktop commented 8 years ago

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

theus commented 8 years ago

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

lawrencegs commented 8 years ago

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?

theus commented 8 years ago

@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.

haimn commented 8 years ago

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

Shahor commented 8 years ago

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

kirsan31 commented 8 years ago

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

auchri commented 8 years ago

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

stek29 commented 8 years ago

Reactions aren't available in mobile site yet.

auchri commented 8 years ago

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

vgonisanz commented 8 years ago

With this feature, I will change hipchat for telegram desktop directly!

givisok commented 8 years ago

Only that feature stops from using telegram on work.

vgonisanz commented 8 years ago

We want to change skype/hipchat/hangout on work for telegram desktop :8ball:

chibisov commented 8 years ago

We're waiting for this feature too! For now we've built a small bot which replies with rtf files. Looks convenient for mobile preview:

https://telegram.me/pastemebot

It works in inline mode too replying with urls for rtf files.

de1mat commented 8 years ago

Really hoping to see support for code snippets with syntax highlighting. Even better if Telegram would allow centralised viewing of all code snippets via the "Shared Media" viewer.

gosteev commented 8 years ago

hmm...'shared code' inside media section - great idea. too great to be implemented 😄

Dessix commented 7 years ago

LaTeX would be awesome to see available.

Niklan commented 7 years ago

I think code must be like media files with little preview or just name and some meta info, but on click opens in new modal window with syntax highlighting. Also would be great if we can edit it and resend edited version after that.

theus commented 7 years ago

At least here in Brazil, many developers uses Telegram so is very useful this feature 😇

--

Theus Falcão Sent by Gmail Mobile

berroteran commented 7 years ago

+999

berroteran commented 7 years ago

Nicaragua, from centroAmerica, we like this

Piterden commented 7 years ago

This would be nice ```php

class StreamsServiceProvider extends ServiceProvider
{
    use DispatchesJobs;
    protected $schedule = [];
}

```

cauebs commented 7 years ago

Any progress on this? If not, is there any opposition?

Piterden commented 7 years ago

I suppose, they just don't want to be the best messenger for programmers :) image

arenaq commented 7 years ago

Come on, developers! It's not that hard to implement!

If you are scared it might mess up with non-programmer users, just make some obscure rules to enable it, prefixes, etc., we won't mind :)

Piterden commented 7 years ago

But, don't forget guys, there are some more serious problems. For example, Telegram, could be blocked in Russia soon, and so on...

That's interesting, could the community start such project based on inline bot? I had seen few implementations, but they are not enough convenient for everyday use.

Piterden commented 7 years ago

Thoughts? Community! ))

sigod commented 7 years ago

If you are scared it might mess up with non-programmer users, just make some obscure rules to enable it, prefixes, etc., we won't mind :)

What? It's already done through use of code blocks. I'm talking about formatting, not highlighting. And it doesn't mess anything up for non-programmers. Or are talking about autodetection? I hope not, as it's very bad idea.

That's interesting, could the community start such project based on inline bot?

Nah. Inline bots are confusing. Should just have clear rules for formatting/highlighting.

Piterden commented 7 years ago

Formatting is not so clear, so it could be. I mean, if you would write ``` multiline block, it would transform your code to many lines limited by ` sign. It's not fully useful for some cases.

Highlighting that what we talk above.

Inline bots... Unfortunately, you are right. ((( This is weird thing. But, as I think, the problem is deeper, some low level problem, like the shell which not supports coloring? Correct me, please if I'm wrong.

arenaq commented 7 years ago

But, don't forget guys, there are some more serious problems. For example, Telegram, could be blocked in Russia soon, and so on...

Not our problem :)

What? It's already done through use of code blocks. I'm talking about formatting, not highlighting. And it doesn't mess anything up for non-programmers. Or are talking about autodetection? I hope not, as it's very bad idea.

I am trying to come up with some reason why this is not yet implemented. So I hypothesized that maybe they are worried that autodetection could affect regular users, but I agree with you ofc, that such fears are missplaced.