# telegram-text
**Python markup module for Telegram messenger.
This module provides a rich list of components to build any possible
markup fast and render it to specific _html_ and _MarkdownV2_ formats.**
[![versions](https://img.shields.io/pypi/pyversions/telegram-text.svg)](https://github.com/SKY-ALIN/telegram-text)
![Tests](https://github.com/SKY-ALIN/telegram-text/actions/workflows/tests.yml/badge.svg)
![Code Quality](https://github.com/SKY-ALIN/telegram-text/actions/workflows/code-quality.yml/badge.svg)
[![codecov](https://codecov.io/gh/SKY-ALIN/telegram-text/branch/dev/graph/badge.svg?token=BK0ASC89B9)](https://codecov.io/gh/SKY-ALIN/telegram-text)
[![PyPI version fury.io](https://badge.fury.io/py/telegram-text.svg)](https://pypi.org/project/telegram-text/)
[![license](https://img.shields.io/github/license/SKY-ALIN/telegram-text.svg)](https://github.com/SKY-ALIN/telegram-text/blob/main/LICENSE)
---
### Installation
Install using `pip install telegram-text` or `poetry add telegram-text`
Also, `telegram-text` is integrated into following packages:
| Module | Installation | Import | Documentation |
| ------ | ------------ | ------ | ------------- |
| [python-telegram](https://github.com/alexander-akhmetov/python-telegram) | `pip install python-telegram` | `from telegram.text import ...` | [Readme](https://github.com/alexander-akhmetov/python-telegram/blob/master/README.md) |
| [OrigamiBot](https://github.com/cmd410/OrigamiBot) | `pip install origamibot[telegram-text]` | `from origamibot.text import ...` | [Release](https://github.com/cmd410/OrigamiBot/releases/tag/v2.3.0) |
| [TGramBot](https://github.com/KeralaBots/TGramBot) | `pip install tgrambot` | `from tgrambot.text import ...` | [Readme](https://github.com/KeralaBots/TGramBot/blob/alpha/README.md) |
### Basic Example
```python
from telegram_text import Bold, Italic, Underline
text = Underline(Bold("Bold") + "and" + Italic("italic") + "with underline.")
```
<p align="center">
<img
width="400"
src="https://raw.githubusercontent.com/SKY-ALIN/telegram-text/dev/docs/source/_static/basic_example_result.jpg"
/>
</p>
### Advanced Example
```python
from telegram_text import Bold, Chain, Italic, TOMLSection, Hashtag, Link, UnorderedList
description = "A Channel about software developing and distributing. Subscribe to follow new technologies."
tags: dict[str, str] = {...} # Tags description with following format `tag: tag_description`
links: dict[str, str] = {...} # Links with following format `text: url`
menu = Chain(
TOMLSection(
'Menu',
Italic(description),
),
TOMLSection(
'Tags',
*[Hashtag(tag, style=Bold) + f"- {about}" for tag, about in tags.items()],
),
TOMLSection(
'Links',
UnorderedList(*[Link(text, url) for text, url in links.items()]),
),
sep='\n\n'
)
```
![Advanced Example Result](https://raw.githubusercontent.com/SKY-ALIN/telegram-text/dev/docs/source/_static/advanced_example_result.jpg)
---
Full documentation and reference are available at
[telegram-text.alinsky.tech](https://telegram-text.alinsky.tech)
Raw data
{
"_id": null,
"home_page": "https://telegram-text.alinsky.tech",
"name": "telegram_text",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8.1,<4.0.0",
"maintainer_email": "",
"keywords": "telegram,markup,markdown,html,formating",
"author": "Vladimir Alinsky",
"author_email": "Vladimir@Alinsky.tech",
"download_url": "https://files.pythonhosted.org/packages/6e/cf/b707b994ecb759a533e479e57e59ebcf6e806643fff5a53f05743ae817ac/telegram_text-0.2.0.tar.gz",
"platform": null,
"description": "# telegram-text\n**Python markup module for Telegram messenger.\nThis module provides a rich list of components to build any possible\nmarkup fast and render it to specific _html_ and _MarkdownV2_ formats.**\n\n[![versions](https://img.shields.io/pypi/pyversions/telegram-text.svg)](https://github.com/SKY-ALIN/telegram-text)\n![Tests](https://github.com/SKY-ALIN/telegram-text/actions/workflows/tests.yml/badge.svg)\n![Code Quality](https://github.com/SKY-ALIN/telegram-text/actions/workflows/code-quality.yml/badge.svg)\n[![codecov](https://codecov.io/gh/SKY-ALIN/telegram-text/branch/dev/graph/badge.svg?token=BK0ASC89B9)](https://codecov.io/gh/SKY-ALIN/telegram-text)\n[![PyPI version fury.io](https://badge.fury.io/py/telegram-text.svg)](https://pypi.org/project/telegram-text/)\n[![license](https://img.shields.io/github/license/SKY-ALIN/telegram-text.svg)](https://github.com/SKY-ALIN/telegram-text/blob/main/LICENSE)\n\n---\n\n### Installation\nInstall using `pip install telegram-text` or `poetry add telegram-text`\n\nAlso, `telegram-text` is integrated into following packages:\n\n| Module | Installation | Import | Documentation |\n| ------ | ------------ | ------ | ------------- |\n| [python-telegram](https://github.com/alexander-akhmetov/python-telegram) | `pip install python-telegram` | `from telegram.text import ...` | [Readme](https://github.com/alexander-akhmetov/python-telegram/blob/master/README.md) |\n| [OrigamiBot](https://github.com/cmd410/OrigamiBot) | `pip install origamibot[telegram-text]` | `from origamibot.text import ...` | [Release](https://github.com/cmd410/OrigamiBot/releases/tag/v2.3.0) |\n| [TGramBot](https://github.com/KeralaBots/TGramBot) | `pip install tgrambot` | `from tgrambot.text import ...` | [Readme](https://github.com/KeralaBots/TGramBot/blob/alpha/README.md) |\n\n### Basic Example\n\n```python\nfrom telegram_text import Bold, Italic, Underline\n\ntext = Underline(Bold(\"Bold\") + \"and\" + Italic(\"italic\") + \"with underline.\")\n```\n\n<p align=\"center\">\n <img \n width=\"400\"\n src=\"https://raw.githubusercontent.com/SKY-ALIN/telegram-text/dev/docs/source/_static/basic_example_result.jpg\"\n />\n</p>\n\n### Advanced Example\n\n```python\nfrom telegram_text import Bold, Chain, Italic, TOMLSection, Hashtag, Link, UnorderedList\n\ndescription = \"A Channel about software developing and distributing. Subscribe to follow new technologies.\"\ntags: dict[str, str] = {...} # Tags description with following format `tag: tag_description`\nlinks: dict[str, str] = {...} # Links with following format `text: url`\n\nmenu = Chain(\n TOMLSection(\n 'Menu',\n Italic(description),\n ),\n TOMLSection(\n 'Tags',\n *[Hashtag(tag, style=Bold) + f\"- {about}\" for tag, about in tags.items()],\n ),\n TOMLSection(\n 'Links',\n UnorderedList(*[Link(text, url) for text, url in links.items()]),\n ),\n sep='\\n\\n'\n)\n```\n\n![Advanced Example Result](https://raw.githubusercontent.com/SKY-ALIN/telegram-text/dev/docs/source/_static/advanced_example_result.jpg)\n\n---\n\nFull documentation and reference are available at \n[telegram-text.alinsky.tech](https://telegram-text.alinsky.tech)",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python markup module for Telegram messenger. This module provides a rich list of components to build any possible markup fast and render it to specific html or MarkdownV2 formats.",
"version": "0.2.0",
"project_urls": {
"Homepage": "https://telegram-text.alinsky.tech",
"Repository": "https://github.com/SKY-ALIN/telegram-text"
},
"split_keywords": [
"telegram",
"markup",
"markdown",
"html",
"formating"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2a1e88e9126640be7ddfa423d9ae7ac559577ab8877d45e1d32907c02602cdb3",
"md5": "1cdce1d15f7d95629c57d70863b1a629",
"sha256": "5752744dc5f91f3f7f0ec1becbf10adb86d586d9338e0aef74fd76a7261283ca"
},
"downloads": -1,
"filename": "telegram_text-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1cdce1d15f7d95629c57d70863b1a629",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8.1,<4.0.0",
"size": 9059,
"upload_time": "2024-01-13T15:22:42",
"upload_time_iso_8601": "2024-01-13T15:22:42.895459Z",
"url": "https://files.pythonhosted.org/packages/2a/1e/88e9126640be7ddfa423d9ae7ac559577ab8877d45e1d32907c02602cdb3/telegram_text-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6ecfb707b994ecb759a533e479e57e59ebcf6e806643fff5a53f05743ae817ac",
"md5": "afe4ccc01833e755beea2c1c7edad543",
"sha256": "ee295a35f2c77246dd9a80c5e1a8deccc598958dff35740697901c632c6121fa"
},
"downloads": -1,
"filename": "telegram_text-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "afe4ccc01833e755beea2c1c7edad543",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8.1,<4.0.0",
"size": 7943,
"upload_time": "2024-01-13T15:22:44",
"upload_time_iso_8601": "2024-01-13T15:22:44.500178Z",
"url": "https://files.pythonhosted.org/packages/6e/cf/b707b994ecb759a533e479e57e59ebcf6e806643fff5a53f05743ae817ac/telegram_text-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-13 15:22:44",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "SKY-ALIN",
"github_project": "telegram-text",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "telegram_text"
}