AndydeCleyre / colorcodebot

A simple Telegram bot for syntax highlighting
Do What The F*ck You Want To Public License
45 stars 6 forks source link

remove, or made optional line numbers #4

Closed kirsan31 closed 6 years ago

kirsan31 commented 6 years ago

Because, line numbers prevent simple copy paste of generated code!

my 50 cents... ![html](https://user-images.githubusercontent.com/17767561/39043914-5227df5e-4497-11e8-8ffb-3e093e0896a0.gif)
AndydeCleyre commented 6 years ago

Makes sense to me, thanks, I'll change it.

AndydeCleyre commented 6 years ago

Now that pygments is generating the html, I've got it putting the line numbers in its own table, so the code is still select-able on its own. This is in the develop branch, but is live on the bot. If this is good for you, please go ahead and close this issue.

kirsan31 commented 6 years ago

I'm Not at home Now and Can't Test it by Myself. But my friend told me that QLabel can't handle new formatting :-( I used QLabel and qtextedit to view html directly in telegram. You can see it under spoiler in my 1 post.

kirsan31 commented 6 years ago

Yes, QLabel/QTextEdit rendering completely broken :( Same code: image QLabel and QTextEdit are the only controls for html rendering in tdesktop for now :( It Will be very handful if we can view your files in tdesktop (with some modifications of course).

QLabel/QTextEdit supported HTML Subset. But, IMHO, simple removing line numbers make all happy :)

AndydeCleyre commented 6 years ago

I'd prefer to stick with pygments now than revert to highlight, so I'll see if I can fiddle with it and get a more compatible html output.

Is there a standalone command I can use to test html rendering with QLabel/QTextEdit?

kirsan31 commented 6 years ago

Is there a standalone command I can use to test html rendering with QLabel/QTextEdit?

Sorry, I don't know :( I Pushed last changes (not final) to my Fork of tdesktop. If you can't compile it, here windows binary: Telegram_mod.zip It open html file in QLabel, if it's size < 50 kb and resulting view fit in your screen resolution.

AndydeCleyre commented 6 years ago

Why not use qwebengineview?

The initial reason for this issue, selecting and copying code without interference from line numbers, is resolved.

For another requirement, please open a new issue.

kirsan31 commented 6 years ago

@AndydeCleyre

Why not use qwebengineview?

Because qwebengineview cannot be linked statically, so it's no way to use it in Tdesktop. But anyway, it's very monstrous and slow ...

AndydeCleyre commented 3 years ago

@kirsan31 FYI the backend has been changed back to highlight, so the html may render better for you. Selection independent of line numbers seems to be working.