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

text decoration pre() bug #596

Closed
p82o opened this issue Jun 4, 2021 · 1 comment · Fixed by #597
Closed

text decoration pre() bug #596

p82o opened this issue Jun 4, 2021 · 1 comment · Fixed by #597
Labels
bug Something is wrong with the framework duplicate This issue already exists

Comments

@p82o
Copy link

p82o commented Jun 4, 2021

Context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

  • Operating System: Any
  • Python Version: 3.8+
  • aiogram version: latest
  • aiohttp version: latest
  • uvloop version (if installed): irrelevant

Expected Behavior

from aiogram.utils import markdown as md

if parse_mode == 'MarkdownV2':
    result = md.pre(md.escape_md(text))
else:
    result = md.hpre(md.quote_html(text))

Current Behavior

from aiogram.utils import markdown as md

if parse_mode == 'MarkdownV2':
    result = md.pre(f"\n{md.escape_md(text)}\n")
else:
    result = md.hpre(md.quote_html(text))

Failure Information (for bugs)

MarkdownDecoration.pre() and HtmlDecoration.pre() have different behavior.
Markdown(V2) format style when inserted text without '\n' the first line will be defined as code language class and never be displayed in messages.
Besides, symbols '\n' at begin and end of insertioned text are present in the official documentation.

Steps to Reproduce

See Current Behavior code

@evgfilim1
Copy link
Contributor

evgfilim1 commented Jun 4, 2021

Related: #481
I'll mark this one as duplicate, but won't close

@evgfilim1 evgfilim1 added bug Something is wrong with the framework duplicate This issue already exists labels Jun 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is wrong with the framework duplicate This issue already exists
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants