Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yym68686/md2tgmd
md2tgmd is a Markdown to Telegram-specific-markdown(MarkdownV2) converter
https://github.com/yym68686/md2tgmd
converter markdown markdownv2 python telegram telegram-bot
Last synced: about 1 month ago
JSON representation
md2tgmd is a Markdown to Telegram-specific-markdown(MarkdownV2) converter
- Host: GitHub
- URL: https://github.com/yym68686/md2tgmd
- Owner: yym68686
- License: gpl-3.0
- Created: 2023-04-14T05:20:41.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-07-23T19:13:38.000Z (5 months ago)
- Last Synced: 2024-08-04T04:06:52.508Z (5 months ago)
- Topics: converter, markdown, markdownv2, python, telegram, telegram-bot
- Language: Python
- Homepage:
- Size: 43.9 KB
- Stars: 54
- Watchers: 3
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# md2tgmd
[English](README.md) | [Chinese](README_CN.md)
md2tgmd is a Markdown to [Telegram-specific-markdown](https://core.telegram.org/bots/api#formatting-options) 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
```bash
pip install md2tgmd
```## Usage
~~~python
From md2tgmd import escapetext = '''
# 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)
![1.0.0](http://version.com)- Item 1 -
- Item 1 -
- Item 1 -
* Item 2 #
* Item 3 ~1. Item 1
2. Item 2sudo 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.