From fd507ca51f11c10ff5ff2c8261eafd916216a5da Mon Sep 17 00:00:00 2001 From: sudoskys Date: Tue, 19 Nov 2024 13:28:18 +0800 Subject: [PATCH 1/3] :books: docs: update README badges and formatting :package: chore: add repository URL to pyproject.toml --- README.md | 6 +++--- pyproject.toml | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 23435e7..056a3d2 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ # telegramify-markdown -[![PyPI version](https://badge.fury.io/py/telegramify-markdown.svg)](https://badge.fury.io/py/telegramify-markdown) +![GitHub Repo stars](https://img.shields.io/github/stars/sudoskys/telegramify-markdown?style=social) +[![PyPI version](https://badge.fury.io/py/telegramify-markdown.svg)](https://badge.fury.io/py/telegramify-markdown) [![Downloads](https://pepy.tech/badge/telegramify-markdown)](https://pepy.tech/project/telegramify-markdown) -**Effortlessly Convert Raw Markdown to Telegram's [MarkdownV2](https://core.telegram.org/bots/api#markdownv2-style) -Style** +**Effortlessly Convert Raw Markdown to Telegram's [MarkdownV2](https://core.telegram.org/bots/api#markdownv2-style) Style** Say goodbye to formatting issues! You no longer need to write parsers to convert raw Markdown text into Telegram's MarkdownV2 format. diff --git a/pyproject.toml b/pyproject.toml index 0ce2dfa..86be182 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,6 +14,9 @@ requires-python = ">=3.8" readme = "README.md" license = { text = "MIT" } +[project.urls] +repository = "https://github.com/sudoskys/telegram-sticker-utils" + [build-system] requires = ["pdm-backend"] build-backend = "pdm.backend" From 93da7ce78e1ecf64af32bf0fc0c2fcb579d5db92 Mon Sep 17 00:00:00 2001 From: sudoskys Date: Thu, 21 Nov 2024 17:10:05 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=86=95=20feat(latex=5Fescape):=20add?= =?UTF-8?q?=20support=20for=20\left=20and=20\right=20commands?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🔧 chore: update version to 0.1.17 in pyproject.toml 🚫 ci: update .gitignore to exclude deprecated symbols file --- .gitignore | 3 ++- playground/show_send.py | 8 ++++++++ pyproject.toml | 2 +- src/telegramify_markdown/latex_escape/helper.py | 10 ++++++++++ 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 47c147d..3cb2104 100644 --- a/.gitignore +++ b/.gitignore @@ -159,4 +159,5 @@ cython_debug/ # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ /.pdm-python -.idea/ \ No newline at end of file +.idea/ +/src/telegramify_markdown/latex_escape/_deprecated_symbols.py diff --git a/playground/show_send.py b/playground/show_send.py index ea3227d..913c8d5 100644 --- a/playground/show_send.py +++ b/playground/show_send.py @@ -42,6 +42,14 @@ \] - Inline: \(F = G\frac{{m_1m_2}}{{r^4}}\) +\( +A = X × \left( (P)/100 \right) × (V)/365 +\) + +\( +\text{R} = \frac{\text{EXAMPLE}}{\text{Any}} +\) + There \frac{1}{2} not in the latex block. **Table** diff --git a/pyproject.toml b/pyproject.toml index 86be182..a7a49d1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "telegramify-markdown" -version = "0.1.16" +version = "0.1.17" description = "Convert Markdown to a format usable by Telegram." authors = [ { name = "sudoskys", email = "coldlando@hotmail.com" }, diff --git a/src/telegramify_markdown/latex_escape/helper.py b/src/telegramify_markdown/latex_escape/helper.py index f4ff6a6..c1598ce 100644 --- a/src/telegramify_markdown/latex_escape/helper.py +++ b/src/telegramify_markdown/latex_escape/helper.py @@ -199,6 +199,12 @@ def handle_command(self, command, latex, index): elif command == "\\text": text, index = self.parse_block(latex, index) return text, index + elif command == "\\right": + text, index = self.parse_block(latex, index) + return text, index + elif command == "\\left": + text, index = self.parse_block(latex, index) + return text, index return command, index @staticmethod @@ -281,4 +287,8 @@ def convert(self, latex): 一元二次方程求解公式:(x = \frac{{-b \pm \sqrt{{b^2 - 4ac}}}}{2a}) 圆的面积:(A = \pi r^2) 自然对数的底 (e) 的著名等式:(e^{i\pi} + 1 = 0) + +A = X × \left( (P)/100 \right) × (V)/365 + +\text{R} = \frac{\text{EXAMPLE}}{\text{Any}} """))) From 65838789099077ecb54883e1ead7d5ecaa4fee3c Mon Sep 17 00:00:00 2001 From: sudoskys Date: Thu, 21 Nov 2024 17:12:19 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=94=A7=20fix(pyproject):=20update=20r?= =?UTF-8?q?epository=20URL=20in=20pyproject.toml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index a7a49d1..fa98129 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,7 @@ readme = "README.md" license = { text = "MIT" } [project.urls] -repository = "https://github.com/sudoskys/telegram-sticker-utils" +repository = "https://github.com/sudoskys/telegramify-markdown" [build-system] requires = ["pdm-backend"]