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

Add TelegramRenderer || красивый контент в телеге #1255

Merged
merged 4 commits into from
Sep 9, 2024

Conversation

Bobronium
Copy link
Contributor

@Bobronium Bobronium commented Sep 8, 2024

Motivation

I was going to just add URLs to telegram images, so it would be possible to view new memes without loading the whole comments section...

However this quickly turned into a quest of implementing support for rendering markdown posts for TG.

Markdown
1. Учишь английский
	- ![Oi mate...](https://i.imgflip.com/705kt7.jpg)
3. ~~Ду...~~ Учишь Питон
	```python
	print("Hello, Vas3k!")
	```
3. Едешь в Германию работать
	- [HowToBerlin](https://howtoberlin.de/)
Before After
image image

Changes

  • Replaced PlainRenderer with TelegramRenderer to support Telegram formatting
  • Replaced render_plain with render_tg that now passes through HTML tags
  • Updated render_plain to render_tg across all telegram messages templates
  • Don't wrap intro in a code block (for moderators)

Upd. Left render_plain and PlainRenderer in place for future use

@vas3k
Copy link
Owner

vas3k commented Sep 8, 2024

Не удаляй render_plain, он еще пригодится не только для телеграма

@Bobronium
Copy link
Contributor Author

@vas3k, вернул на место

Copy link
Owner

@vas3k vas3k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ну вот так получше. Можем потестить, если будет херово — я откачу обратно на plain

@vas3k vas3k merged commit a5d1000 into vas3k:master Sep 9, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants