Skip to content

Commit

Permalink
🔧 feat: add mermaid diagram rendering and improve logger integration
Browse files Browse the repository at this point in the history
- Implement mermaid diagram support in markdown processing.
- Introduce new logger for better message handling.
- Update type hints for better code clarity.
- Adjusted project dependencies in pyproject.toml.
  • Loading branch information
sudoskys committed Dec 13, 2024
1 parent 99d04ad commit 42ee81f
Show file tree
Hide file tree
Showing 9 changed files with 740 additions and 181 deletions.
91 changes: 90 additions & 1 deletion pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions playground/inspect_telegramify.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import os
import pathlib
from time import sleep

from dotenv import load_dotenv
from telebot import TeleBot

import telegramify_markdown
from telegramify_markdown import ContentTypes
from telegramify_markdown.customize import markdown_symbol

tips = """
telegramify_markdown.telegramify
The stability of telegramify_markdown.telegramify is unproven, please keep good log records.
Feel free to check it out, if you have any questions please open an issue
"""

load_dotenv()
telegram_bot_token = os.getenv("TELEGRAM_BOT_TOKEN", None)
chat_id = os.getenv("TELEGRAM_CHAT_ID", None)
bot = TeleBot(telegram_bot_token)

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 = pathlib.Path(__file__).parent.joinpath("t_longtext.md").read_text(encoding="utf-8")
boxs = telegramify_markdown.telegramify(md)
for item in boxs:
print("Sent one item")
sleep(0.2)
if item.content_type == ContentTypes.TEXT:
print("TEXT")
print(item.content)
elif item.content_type == ContentTypes.PHOTO:
print("PHOTO")
print(item.caption)
elif item.content_type == ContentTypes.FILE:
print("FILE")
print(item.file_name)
Loading

0 comments on commit 42ee81f

Please sign in to comment.