mistune-telegram


Namemistune-telegram JSON
Version 0.2.0 PyPI version JSON
download
home_pagehttps://github.com/impocode/mistune-telegram
SummaryPlugin mistune for converting markdown into Telegram format.
upload_time2025-01-01 21:18:51
maintainerimpocode
docs_urlNone
authorimpocode
requires_python<4.0,>=3.8
licenseMIT
keywords mistune telegram markdown markdown-parser
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Mistune Telegram

Plugin mistune for converting Markdown into Telegram format.

## Supported Markdown elements

|  Markdown element  | Telegram Markdown  | Telegram Markdown V2 | Telegram HTML |
| :----------------: | :---------------:  | :------------------: | :-----------: |
|      Headings      | :white_check_mark: |  :white_check_mark:  |      :x:      |
|     Paragraphs     | :white_check_mark: |  :white_check_mark:  |      :x:      |
|     Line Breaks    | :white_check_mark: |  :white_check_mark:  |      :x:      |
|        Bold        | :white_check_mark: |  :white_check_mark:  |      :x:      |
|       Italic       | :white_check_mark: |  :white_check_mark:  |      :x:      |
|     Blockquotes    |         :x:        |         :x:          |      :x:      |
|       Lists        |         :x:        |         :x:          |      :x:      |
|        Code        | :white_check_mark: |  :white_check_mark:  |      :x:      |
|     Code blocks    | :white_check_mark: |  :white_check_mark:  |      :x:      |
|  Horizontal rules  |         :x:        |         :x:          |      :x:      |
|        Links       | :white_check_mark: |  :white_check_mark:  |      :x:      |
|       Images       |         :x:        |         :x:          |      :x:      |

## Install

```shell
$ pip install mistune-telegram
```

Or use your python package manager.

## Usage

[Markdown style](https://core.telegram.org/bots/api#markdown-style) example:

````python
import mistune
from mistune_telegram import TelegramMarkdownRenderer
telegram_style = mistune.create_markdown(renderer=TelegramMarkdownRenderer())

print(telegram_style(
"""
# Heading level 1
## Heading level 2
### Heading level 3
#### Heading level 4
##### Heading level 5
###### Heading level 6

Heading level 1
===============
Heading level 2
---------------

First paragraph.

Second paragraph.

First line.
Second line.

**bold**
__bold__

*italic*
_italic_

`code`

```
code blocks
```

```python
code blocks written in the Python programming language
```

[link](http://www.example.com/)

"""))
````

Output:

````
*Heading level 1*

*Heading level 2*

*Heading level 3*

*Heading level 4*

*Heading level 5*

*Heading level 6*

*Heading level 1*

*Heading level 2*

First paragraph.

Second paragraph.

First line.
Second line.

*bold*
*bold*

_italic_
_italic_

`code`

```
code blocks
```

```python
code blocks written in the Python programming language
```

[link](http://www.example.com/)
````

[MarkdownV2 style](https://core.telegram.org/bots/api#markdownv2-style) example:

````python
import mistune
from mistune.plugins.formatting import strikethrough
from mistune_telegram import TelegramMarkdownV2Renderer

telegram_style = mistune.create_markdown(renderer=TelegramMarkdownV2Renderer(), plugins=[strikethrough])

print(telegram_style(
"""
# Heading level 1
## Heading level 2
### Heading level 3
#### Heading level 4
##### Heading level 5
###### Heading level 6

Heading level 1
===============
Heading level 2
---------------

First paragraph.

Second paragraph.

First line.
Second line.

**bold**
__bold__

*italic*
_italic_

`code`

```
code blocks
```

```python
code blocks written in the Python programming language
```

[link](http://www.example.com/)

~~strikethrough~~

"""))
````

Output:

````
*Heading level 1*

*Heading level 2*

*Heading level 3*

*Heading level 4*

*Heading level 5*

*Heading level 6*

*Heading level 1*

*Heading level 2*

First paragraph.

Second paragraph.

First line.
Second line.

*bold*
*bold*

_italic_
_italic_

`code`

```
code blocks
```

```python
code blocks written in the Python programming language
```

[link](http://www.example.com/)

~strikethrough~

````

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/impocode/mistune-telegram",
    "name": "mistune-telegram",
    "maintainer": "impocode",
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": "impocode@impocode.one",
    "keywords": "mistune, telegram, markdown, markdown-parser",
    "author": "impocode",
    "author_email": "impocode@impocode.one",
    "download_url": "https://files.pythonhosted.org/packages/30/6b/1c1a8fe9e53fa1d772fd6dec914fcdb6fcff0f74f2f90bb6006f769569b7/mistune_telegram-0.2.0.tar.gz",
    "platform": null,
    "description": "# Mistune Telegram\n\nPlugin mistune for converting Markdown into Telegram format.\n\n## Supported Markdown elements\n\n|  Markdown element  | Telegram Markdown  | Telegram Markdown V2 | Telegram HTML |\n| :----------------: | :---------------:  | :------------------: | :-----------: |\n|      Headings      | :white_check_mark: |  :white_check_mark:  |      :x:      |\n|     Paragraphs     | :white_check_mark: |  :white_check_mark:  |      :x:      |\n|     Line Breaks    | :white_check_mark: |  :white_check_mark:  |      :x:      |\n|        Bold        | :white_check_mark: |  :white_check_mark:  |      :x:      |\n|       Italic       | :white_check_mark: |  :white_check_mark:  |      :x:      |\n|     Blockquotes    |         :x:        |         :x:          |      :x:      |\n|       Lists        |         :x:        |         :x:          |      :x:      |\n|        Code        | :white_check_mark: |  :white_check_mark:  |      :x:      |\n|     Code blocks    | :white_check_mark: |  :white_check_mark:  |      :x:      |\n|  Horizontal rules  |         :x:        |         :x:          |      :x:      |\n|        Links       | :white_check_mark: |  :white_check_mark:  |      :x:      |\n|       Images       |         :x:        |         :x:          |      :x:      |\n\n## Install\n\n```shell\n$ pip install mistune-telegram\n```\n\nOr use your python package manager.\n\n## Usage\n\n[Markdown style](https://core.telegram.org/bots/api#markdown-style) example:\n\n````python\nimport mistune\nfrom mistune_telegram import TelegramMarkdownRenderer\ntelegram_style = mistune.create_markdown(renderer=TelegramMarkdownRenderer())\n\nprint(telegram_style(\n\"\"\"\n# Heading level 1\n## Heading level 2\n### Heading level 3\n#### Heading level 4\n##### Heading level 5\n###### Heading level 6\n\nHeading level 1\n===============\nHeading level 2\n---------------\n\nFirst paragraph.\n\nSecond paragraph.\n\nFirst line.\nSecond line.\n\n**bold**\n__bold__\n\n*italic*\n_italic_\n\n`code`\n\n```\ncode blocks\n```\n\n```python\ncode blocks written in the Python programming language\n```\n\n[link](http://www.example.com/)\n\n\"\"\"))\n````\n\nOutput:\n\n````\n*Heading level 1*\n\n*Heading level 2*\n\n*Heading level 3*\n\n*Heading level 4*\n\n*Heading level 5*\n\n*Heading level 6*\n\n*Heading level 1*\n\n*Heading level 2*\n\nFirst paragraph.\n\nSecond paragraph.\n\nFirst line.\nSecond line.\n\n*bold*\n*bold*\n\n_italic_\n_italic_\n\n`code`\n\n```\ncode blocks\n```\n\n```python\ncode blocks written in the Python programming language\n```\n\n[link](http://www.example.com/)\n````\n\n[MarkdownV2 style](https://core.telegram.org/bots/api#markdownv2-style) example:\n\n````python\nimport mistune\nfrom mistune.plugins.formatting import strikethrough\nfrom mistune_telegram import TelegramMarkdownV2Renderer\n\ntelegram_style = mistune.create_markdown(renderer=TelegramMarkdownV2Renderer(), plugins=[strikethrough])\n\nprint(telegram_style(\n\"\"\"\n# Heading level 1\n## Heading level 2\n### Heading level 3\n#### Heading level 4\n##### Heading level 5\n###### Heading level 6\n\nHeading level 1\n===============\nHeading level 2\n---------------\n\nFirst paragraph.\n\nSecond paragraph.\n\nFirst line.\nSecond line.\n\n**bold**\n__bold__\n\n*italic*\n_italic_\n\n`code`\n\n```\ncode blocks\n```\n\n```python\ncode blocks written in the Python programming language\n```\n\n[link](http://www.example.com/)\n\n~~strikethrough~~\n\n\"\"\"))\n````\n\nOutput:\n\n````\n*Heading level 1*\n\n*Heading level 2*\n\n*Heading level 3*\n\n*Heading level 4*\n\n*Heading level 5*\n\n*Heading level 6*\n\n*Heading level 1*\n\n*Heading level 2*\n\nFirst paragraph.\n\nSecond paragraph.\n\nFirst line.\nSecond line.\n\n*bold*\n*bold*\n\n_italic_\n_italic_\n\n`code`\n\n```\ncode blocks\n```\n\n```python\ncode blocks written in the Python programming language\n```\n\n[link](http://www.example.com/)\n\n~strikethrough~\n\n````\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Plugin mistune for converting markdown into Telegram format.",
    "version": "0.2.0",
    "project_urls": {
        "Documentation": "https://github.com/impocode/mistune-telegram",
        "Homepage": "https://github.com/impocode/mistune-telegram",
        "Repository": "https://github.com/impocode/mistune-telegram"
    },
    "split_keywords": [
        "mistune",
        " telegram",
        " markdown",
        " markdown-parser"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bf2b00c12c1c65d7adc0aca8f64583f4229517bdd665ff04208f11434f4b5a61",
                "md5": "4c602c36315e2d30542c00063e11aa32",
                "sha256": "1e991c9cbb4cef9c9dd6b0c6fcea0f77dddcfda3771ef95fa65d0df8a9e1ba4c"
            },
            "downloads": -1,
            "filename": "mistune_telegram-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4c602c36315e2d30542c00063e11aa32",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 3329,
            "upload_time": "2025-01-01T21:18:49",
            "upload_time_iso_8601": "2025-01-01T21:18:49.442025Z",
            "url": "https://files.pythonhosted.org/packages/bf/2b/00c12c1c65d7adc0aca8f64583f4229517bdd665ff04208f11434f4b5a61/mistune_telegram-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "306b1c1a8fe9e53fa1d772fd6dec914fcdb6fcff0f74f2f90bb6006f769569b7",
                "md5": "f49ce726bfbee1e80e64f9d52f7fb4e1",
                "sha256": "ef0e1990e9b7f50f085c79ede05be9ad97ec5e095334d8c98ff633029f2dd391"
            },
            "downloads": -1,
            "filename": "mistune_telegram-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "f49ce726bfbee1e80e64f9d52f7fb4e1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 2376,
            "upload_time": "2025-01-01T21:18:51",
            "upload_time_iso_8601": "2025-01-01T21:18:51.691407Z",
            "url": "https://files.pythonhosted.org/packages/30/6b/1c1a8fe9e53fa1d772fd6dec914fcdb6fcff0f74f2f90bb6006f769569b7/mistune_telegram-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-01 21:18:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "impocode",
    "github_project": "mistune-telegram",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "mistune-telegram"
}
        
Elapsed time: 0.46189s