md2tgmd
md2tgmd is a Markdown to Telegram-specific-markdown converter.
Feature
- Supports most of the specific Markdown syntax for Telegram, including: headings, bold, italic, strikethrough, code blocks, links, and quotes.
- Support the conversion of LaTeX formulas in Markdown to Unicode characters to improve the readability of mathematical formulas in Telegram.
- Support syntax highlighting for code blocks in Markdown.
Install
pip install md2tgmd
Usage
From md2tgmd import escape
text = '''
# Title
\[ \\varphi(35) = 35 \\left(1 - \\frac{1}{5}\\right) \\left(1 - \\frac{1}{7}\\right) \]
**Bold**
```
# Comment
print(qwer) # ferfe
ni1
```
# bn
# b
# Title
## Subtitle
[1.0.0](http://version.com)

- Item 1 -
- Item 1 -
- Item 1 -
* Item 2 #
* Item 3 ~
1. Item 1
2. Item 2
sudo apt install mesa-utils # Install
```python
# Comment
print("1.1\n")_
\subsubsection{1.1}
```
\subsubsection{1.1}
And simple text `with-ten` `with+ten` + some - **symbols**. # `-` inside `with-ten` will not be escaped
```
print("Hello, World!") -
```
Cxy = abs (Pxy)**2/ (Pxx*Pyy)
`a`a-b-c`n`
`-a----++++`++a-b-c`-n-`
`[^``]*`a``b-c``d``
# pattern = r"`[^`]*`-([^`-]*)``
w`-a----`ccccc`-n-`bbbb``a
'''
print(escape(text))
'''
▎*Title*
ϕ(35) = 35(1 - ⅕)(1 - 1/7)
*Bold*
```
\# Comment
print\(qwer\) \# ferfe
ni1
```
▎*bn*
▎*b*
▎*Title*
▎*Subtitle*
[1\.0\.0](http://version\.com)
[1\.0\.0](http://version\.com)
• Item 1 \-
• Item 1 \-
• Item 1 \-
• Item 2 \#
• Item 3 \~
1\. Item 1
2\. Item 2
sudo apt install mesa\-utils \# Install
```python
\# Comment
print\("1\.1\\n"\)\_
\\subsubsection\{1\.1\}
```
\\subsubsection\{1\.1\}
And simple text `with-ten` `with+ten` \+ some \- *symbols*\. \# `-` inside `with-ten` will not be escaped
```
print\("Hello, World\!"\) -
```
Cxy \= abs \(Pxy\)\*\*2/ \(Pxx\*Pyy\)
`a`a\-b\-c`n`
`-a----++++`\+\+a\-b\-c`-n-`
`\[^\`\`\]\*`a\`\`b\-c\`\`d\`\`
▎*pattern*
w`-a----`ccccc`-n-`bbbb\`\`a
'''
Reference
https://github.com/skoropadas/telegramify-markdown
License
This project is licensed under GPLv3, which means you are free to copy, distribute, and modify the software, as long as all modifications and derivative works are also released under the same license.
Metadata
Release files for md2tgmd 0.3.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| md2tgmd-0.3.10.tar.gz | 28.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| md2tgmd-0.3.10-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 57.0 kB
Release files / md2tgmd-0.3.10.tar.gz
| Download URL | md2tgmd-0.3.10.tar.gz |
|---|---|
| Size | 28.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
613fef6da1c00101ea94d3b8658974f7f21ae8cb84d9ab16814fdd9daa5026f3
|
|
BLAKE2b-256 checksum How to use checksums |
bfe7f43e7f79c72d12fd8f038c6523e9b17d98b619d09806376e04e6b0787ad1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|
Release files / md2tgmd-0.3.10-py3-none-any.whl
| Download URL | md2tgmd-0.3.10-py3-none-any.whl |
|---|---|
| Size | 28.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bc3d43831a0b1d1db6c03ce66dfc37878b5b76322f39d5c0caea4e7e7c3c6192
|
|
BLAKE2b-256 checksum How to use checksums |
51ea2afb0a931873469fc9f81a218153b12678cd100ac42107e30fe178fd6aa9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|
Security for md2tgmd 0.3.10
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.