Skip to content

Commit

Permalink
Merge pull request #36 from sudoskys/dev
Browse files Browse the repository at this point in the history
Ignore `\right` `\left` command
  • Loading branch information
sudoskys authored Nov 21, 2024
2 parents d79de20 + 6583878 commit 3ff01f2
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -159,4 +159,5 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
/.pdm-python
.idea/
.idea/
/src/telegramify_markdown/latex_escape/_deprecated_symbols.py
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
8 changes: 8 additions & 0 deletions playground/show_send.py
Original file line number Diff line number Diff line change
Expand Up @@ -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**
Expand Down
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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" },
Expand All @@ -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"
Expand Down
10 changes: 10 additions & 0 deletions src/telegramify_markdown/latex_escape/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}}
""")))

0 comments on commit 3ff01f2

Please sign in to comment.