Convert Markdown to a format usable by Telegram.
Project description
telegramify-markdown
🪄 Python Telegram markdown Converter | No more worrying about formatting.
Raw Markdown -> Telegram MarkdownV2 Style
Before the advent of this repository, when you needed to send Markdown content in Telegram rendering, you had to use complex regularization. Today, you can make it easier and customize it to achieve better results!
I used a custom Render to achieve this, using a real environment server to verify the applicability of this tool.
Installation
pip install telegramify-markdown
or if you use pdm
:
pdm add telegramify-markdown
Use case
from telegramify_markdown import convert
from telegramify_markdown.customize import markdown_symbol
markdown_symbol.head_level_1 = "📌" # If you want, Customizing the head level 1 symbol
markdown_symbol.link = "🔗" # If you want, Customizing the link symbol
md = """
# 一级标题 `c!ode` # 一级标题 `code`
[Link!AA](https://www.example.com)
[这是!链接2][asd!asd](https://www.example.com)
[rttt]()
![PIC](https://www.example.com/image.jpg)
"""
converted = convert(md)
print(converted)
output as follows:
*📌 一级标题 `c\!ode` \# 一级标题 `code`*
[Link\!AA](https://www\.example\.com)
\[这是\!链接2\][asd\!asd](https://www\.example\.com)
[rttt]()
🖼[PIC](https://www\.example\.com/image\.jpg)
Note: Telegram Server automatically processes \ again (even after escaping), which is beyond the control of us.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for telegramify_markdown-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f238f95ec2a8638b0e3145a90a3a17c87899401f1ebe71961564d44a6c540a3a |
|
MD5 | 74cf3463feb9c76e48bbd46f0d6bd0fa |
|
BLAKE2b-256 | 81f21e16fc1784f357b8f763fceb7f33c9446989f46211a92726632348e7b1db |
Hashes for telegramify_markdown-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f674b78893a5e66a3f19a2154d328a541579b45c0707c7fcf735b60b3d050934 |
|
MD5 | c76b3d7d7a2b5897561efcf411afcd74 |
|
BLAKE2b-256 | 704eb78a4bf9cc3bb3ce6cae9a5a7d52517797172c6244effef83de2b71554ee |