Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CodeBlock ... #26999

Closed
MaBo2022 opened this issue Oct 29, 2023 · 9 comments
Closed

CodeBlock ... #26999

MaBo2022 opened this issue Oct 29, 2023 · 9 comments

Comments

@MaBo2022
Copy link

MaBo2022 commented Oct 29, 2023

Is your feature request related to a problem?


Describe the solution you'd like

... please a Toggle / Switcher to turn ON or OFF the new CodeBLock, Thanks, it look not good in every Messages or ChannelDescription (see PIC) :)

ScreenShot vom 29 10 2023, 18 14 33 Uhr

SORRY MY ENGLISH, IAM GERMAN ...

Describe alternatives you've considered


Additional context


@guanzo
Copy link

guanzo commented Oct 29, 2023

My telegram bot exclusively sends markdown messages. The message content is ASCII tables, JSON, and lots of numbers, all of which benefit visually from markdown's monospace font. The 4.11 update has added a "copy" UI to every markdown message which is obtrusive and ugly.

image

Please make the "copy" UI optional, or less prominent, on markdown messages.

Potential solutions:

  • Only show copy UI on mouse hover.
  • Make the "copy" text display conditionally somehow.

@john-preston
Copy link
Member

There are two monospace format options in Telegram, one is blocks of monospace, others are inline parts of monospace. If you use the inline type (sent in single ticks ` or somehow else) then it'll look like before. The block type got this upgrade with the header, single-click copy and a dedicated area.

The option to convert block type ones to old layout isn't planned.

@john-preston
Copy link
Member

So to send the old "part of text is monospace" messages you can send them as inline-monospace tags.

@kirsan31
Copy link
Contributor

kirsan31 commented Nov 2, 2023

@john-preston

There are two monospace format options in Telegram, one is blocks of monospace, others are inline parts of monospace. If you use the inline type (sent in single ticks ` or somehow else) then it'll look like before.

With single and triples quotes all are clear. But how to send multiline code block without new copy bloc?
Also what block will be if we are using Monospace from formatting menu? The algorithm is unclear :( And we have many old messages that now receive this new code block :(
For example (this is only one case there are many parsing problems with this):

tg.mp4

@john-preston
Copy link
Member

Monospace formatting in the menu is flawed, because it tries to guess which one to use. Generally it uses block type formatting if you selected some amount of paragraphs (both edges of the selected block are at a newline) and inline type in case it intersects some line. But this doesn't work very well, so it is easier to use the ticks.

@kirsan31
Copy link
Contributor

kirsan31 commented Nov 2, 2023

@john-preston

But this doesn't work very well, so it is easier to use the ticks.

And what about multiline without copy block? How to achieve this:
image
?

@john-preston
Copy link
Member

Well, this is like surrounding each line in single quotes. Message input field doesn't support that (the fact that you got it for full lines selection looks like a bug, it should've been block monospace part).

@kirsan31
Copy link
Contributor

kirsan31 commented Nov 2, 2023

Got it - thank you.

@guanzo
Copy link

guanzo commented Nov 17, 2023

But how to send multiline code block without new copy bloc?

I don't think this was communicated properly. Apparently you can send multiline strings surrounded with single ticks, and it'll look the same as before this update. Not just for "part of the message", but the entire message.

msg is a multiline string (contains \n characters).
Before this update, this code would result in this output:

def sendMarkdown (msg, userId):
    msg = f'```\n{msg}\n```'
    bot.sendMessage(userId, msg, parse_mode=ParseMode.MARKDOWN_V2)

image

After this update, the output is now:
image

To get the original output without the "copy" header and extra UI, just use single ticks.

def sendMarkdown (msg, userId):
    msg = f'`{msg}`'
    bot.sendMessage(userId, msg, parse_mode=ParseMode.MARKDOWN_V2)

Looks fine on both tdesktop and iOS.

1 difference I noticed: message max width is enforced on single tick msgs, which will cause long messages to wrap. It's not enforced on triple tick msgs.

image

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants