Closed leolabs closed 10 months ago
Not our problem :)
Whom do you mean, @arenaq ? I think, it is general problem. At the first it is the problem of Pavel Durov. But I agreed, this is offtop for here.
@Piterden I meant ppl that won't be affected by Telegram blocked in Russia. Was more like a joke, really.
Maybe something like this could be easier to implement instead of trying to do code detection
Slack has the worst implementation of highlighting I ever seen. The best implementation is here, on GitHub.
Still better than nothing, which is what we currently have on Telegram
Does Telegram support any type of modal dialog?
Yes. It does. :-)
EDIT: Sorry, I didn't have any larger file.
Btw, guys. I had avoid that problem with the ST3 and its Export HTML plugin. I even have highlighting with my own colors. Gallery.vue.html.zip You need to unpack and open it in browser then.
PS Especially for paranoiacs, it looks like:
You shouldn’t share files like that.Why don’t you just create a repo and show the source instead? Otherwise noone have a clue what they’re downloading and opening.
Get Outlook for iOS
On Wed, Aug 30, 2017 at 3:22 AM +0200, "Denis Efremov" notifications@github.com wrote:
Btw, guys. I had avoid that problem with the ST3 and its Export HTML plugin. I even have highlighting with my own colors.
Gallery.vue.html.zip
You need to unpack and open it in browser then.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
@rockymontana Bro, you shouldn't leave comments like this ^ :rofl:
That's completely unrelated to TDesktop and to syntax highlighting.
UPD: deleting @gogl92's comment to avoid misinformation and confusion.
My tg don't have this ^
Code highlighting, and extend the 51 character limit per line please!
```languageName code ``` syntax like markdown would be perfect... No need to detect the language (which is not only difficult but error prone)..
for example: ```java public class MyClass { public static void main(String[] args) { System.out.println("Hello world"); } } ``` should give
public class MyClass {
public static void main(String[] args) {
System.out.println("Hello world");
}
}
and ```python def mysum(x, y): return x + y ``` should give
def mysum(x, y):
return x + y
Is any news about code highlighting? Does someone work on this feature?
@Piterden it looks your bot doesn't work as it should be
@ShavidzeT, ya it should be rewritten, I had stopped it now.
PS play while in chess...
@Piterden I see that it's useful feature for telegram, if you looking for maintainers, I can help. I'll ping you on your email.
As a workaround, I made https://t.me/colorcodebot . It's susceptible to #522 problems.
Nice bot, @AndydeCleyre, but I personally hate solarized :joy_cat:
Do you have sources for that your bot? Maybe add there a theme selection functionality from my one?
You know, we could also add there a question about a preferred file format. @AndydeCleyre
Sorry guys your work are great, but imho, this bots are nearly useless :( Code as img already a big compromise, and more easily done via screenshot. Code as html is good, but telegram can't render it => what profit from bot, as many sites offer same functionality? I made some research on this question a time ago, and think that best solution it's implement a html render in telegram. But looking into code, I understand that for me it's hard to achieve, even for personal use :(
@kirsan31 I'm hoping for an in-app solution as well. The benefits of the bot for me:
Guys, we need the instant view of highlighted code!!!
The bot can share statically the prepared for an instant view HTML files.
I always wanted the idea of having a in-app browser inside tdesktop, I made this concepts http://telegra.ph/Telegram-Desktop-In-App-Browser-09-04
@AndydeCleyre Agreed.
quick viewing, especially when associating local html files with a simple renderer
Especially directly in Telegram ;) Back to your bot, theme selection functionality from @Piterden will be great (don't like black theme in c# :) )!
@Piterden
Guys, we need the instant view of highlighted code!!! The bot can share statically the prepared for an instant view HTML files.
If it's possible, I think this is the right direction. But we have no instant view support in tdesktop #3492, and as I understand, instant view is not in html :(
@kirsan31 I invite you to take further colorcodebot discussion to its own issues page, and let me know which of these you would appreciate included: theme previews
@AndydeCleyre did you see this stuff? https://github.com/revolunet/sublimetext-html-export
IMHO it has better render, than your...
Puhleaaase add github-like code highlighting. That would be amazing.
If anyone interested, my workaround for this problem:
@kirsan31 your approach looks better but we still need markdown support 😄
Bump.
@kirsan31 so does your approach need html key for c++ code?
@Piterden
I like your idea with html file creating by bot. So I thinked, if I can create and send such file on the fly in telegram (if I have html markup in clipboard)...
In my mod you need to type ```html
and then paste your html code.
Yes, it's not so good approach, but we are using it along with sending files from bots.
@olleharstedt can I ask if you've tried my bot? https://t.me/colorcodebot
Note that as a convenience, you can invoke it inline to bring up a direct chat button
Totally disagree with this feature. Telegram is for chatting and sharing media, it is not a developer-specific tool. For code sharing use Slack, Mattermost, or whatever.
@adrianopol disagree with you completely.
How is being a developer relevant for Telegram usage? Developers are users too and they want to chat and share as well as others. When I chat with my friends who happens to be developers as well, I don't want to invite then to different platform just because I want to send them a small code snippet.
By the way, how do you know what is Telegram for? By the same logic you could have argued, before introducing Telegram calls, that it was meant only for texting and therefore ppl should go to Skype, Discord, or whatever. Are you saying that you won't accept any change at all?
@adrianopol I think that we do not need "Automatically Syntax-Highlight" we need a "Syntax-Highlight Snippet" that when you need you can Highlight the code in a message.
- If the code (regardless of language) needs highlighting to be understood, it's the ugly code and needs to be rewritten. :)
Why do you highlight your chat then?
Oh you have ugly chat and it needs to be rewritten!
Also I propose you to not use the monospace font, because a good code must be readable even in Arial.
@adrianopol I believe it is just misleading title. If you read what author of this topic wrote, it seems to me that it is very similar to what you are proposing.
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.
@arenaq,
How is being a developer relevant for Telegram usage?
Because this feature is useless for everyone except SW developers. I am not about discarding any improvements or features at all. My message was about a niche feature. Suppose photographers asking for a .psd file previewer, mathematicians asking for LaTeX support, and so on.
Support for calls is a marketing feature, and it is meaningful for all users, so this is not a valid comparison.
Any software product is always a compromise between [a number of features expected by users] and [a number of bugs, fast UI reaction, and a good interrelation between existing features].
The key point is that small code snippets are enough readable without highlighting, and the large ones suffer from size limitation, making them absolutely unreadable (regardless of any highlighting).
it seems to me that it is very similar to what you are proposing
Well, talking about a separate media type (like images, videos) with its own viewer is a more reasonable way, I suppose. But most examples and suggestions are about inline support.
Try my bot @adrianopol @cris_highlight_bot
Compare these two ways.
horizontalWords () {
const words = []
let row = 1
for (row; row <= this.width; row++) {
const rowBlankCells = this.blanks
.filter((cell) => Number(cell.split(':')[1]) === row)
.map((cell) => Number(cell.split(':')[0]))
if (rowBlankCells.length > 0) {
let i = 1
const cols = new Array(this.height).fill(0).map((col) => i++)
if (cols) {
`:${cols.join('::')}:`
.split(new RegExp(`:${rowBlankCells.join(':|:')}:`))
.filter((word) => {
const match = word.match(/:\d+:/g)
return match ? match.length > 1 : false
})
.forEach((word) => {
const match = word.match(/:\d+:/g)
const length = match ? match.length : 0
words.push({
x: Number(word.match(/^:(\d+)/)[1]),
y: row,
type: 'horizontal',
length,
question: '',
})
})
}
} else {
words.push({
x: 1,
y: row,
type: 'horizontal',
length: this.width,
question: '',
})
}
}
return words
},
@adrianopol
Because this feature is useless for everyone except SW developers.
Support for calls is a marketing feature, and it is meaningful for all users
I do not believe it is (to both).
Suppose photographers asking for a .psd file previewer, mathematicians asking for LaTeX support, and so on.
I wouldn't mind. If there will be reasonable demand for it and wouldn't affect other users, why not?
Yes, you are right, it is a compromise, but this is a tiny feature that would not impact performance. In regards of bugs, UI reaction time - this really is negligible, since there are many optimized libraries that can do that.
I would understand the argument about too many options in UI for other users, but since this would be sort of hidden feature, not even that would apply.
And I do believe that in case of snippets, size does not matter. Should be highlighted even when it's just one line :)
PS: I am not talking about parsing all the messages that user type and looking for code, but rather introduce a new syntax for formatting (as now with "`" character, as markdown has for example)
Just like here on GitHub would be nice. @arenaq
```c++
#include <iostream>
using namespace std;
int main()
{
int number;
cout << "Enter an integer: ";
cin >> number;
cout << "You entered " << number;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int number;
cout << "Enter an integer: ";
cin >> number;
cout << "You entered " << number;
return 0;
}
It is enough easy
@Piterden yep, that's exactly what I had in mind 👍
yes, please 👍
Im from a group of devs and we have left gitter for telegram... this is the only feature we miss.
Please implement :)
Any updates?
https://core.telegram.org/bots/api#markdownv2-style
The telegram bot docs has an example of this with python, but it does NOTHING different.
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