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/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/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 0ce2dfa..fa98129 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" }, @@ -14,6 +14,9 @@ requires-python = ">=3.8" readme = "README.md" license = { text = "MIT" } +[project.urls] +repository = "https://github.com/sudoskys/telegramify-markdown" + [build-system] requires = ["pdm-backend"] build-backend = "pdm.backend" 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}} """)))