Metadata-Version: 2.5
Name: kformat-telebot
Version: 0.1.0
Summary: Short Telegram HTML formatting, tables, inline keyboards, and Rich Message JSON helpers for pyTelegramBotAPI.
Project-URL: Homepage, https://pypi.org/project/kformat-telebot/
Project-URL: Repository, https://github.com/YOUR_USERNAME/kformat-telebot
Author: KFormat contributors
License: MIT
License-File: LICENSE
Keywords: bot,formatting,pytelegrambotapi,rich-message,telebot,telegram
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Communications :: Chat
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Provides-Extra: dev
Requires-Dist: build>=1.2; extra == 'dev'
Requires-Dist: twine>=5.1; extra == 'dev'
Provides-Extra: telebot
Requires-Dist: pytelegrambotapi>=4.14; extra == 'telebot'
Description-Content-Type: text/markdown

# KFormat

Short aliases for Telegram HTML formatting, tables, inline keyboards, and Rich Message JSON helpers.

## Install

```bash
pip install kformat-telebot
```

For inline keyboard helpers, install the optional TeleBot dependency:

```bash
pip install "kformat-telebot[telebot]"
```

## Quick example

```python
import telebot
from kformat import K

bot = telebot.TeleBot("YOUR_BOT_TOKEN")

@bot.message_handler(commands=["start"])
def start(message):
    text = (
        K.b("Bold") + "\n"
        + K.un("Underline") + "\n"
        + K.sp("Spoiler") + "\n"
        + K.a("Open website", "https://example.com")
    )
    bot.send_message(message.chat.id, text, parse_mode="HTML")

bot.infinity_polling()
```

## Tables

```python
text = K.table(
    [["Kentucky", "10"], ["Kentucky", "20"]],
    headers=["Name", "Count"]
)
bot.send_message(chat_id, text, parse_mode="HTML")
```

Classic Telegram `sendMessage` has no native table-cell layout, so `K.table` renders
a readable monospace text table.

## Inline keyboard

```python
markup = K.buttons(
    [("Open", "callback:open"), ("Website", "url:https://example.com")],
    [K.btn("Second row", data="second")]
)
bot.send_message(chat_id, "Choose:", reply_markup=markup)
```

## Rich Message JSON

```python
payload = K.rich(
    K.rh("Heading"),
    K.rb("Paragraph"),
    K.rtable([["Name", "Count"], ["Kentucky", "10"]])
)
print(K.rich_json(K.rh("Heading"), K.rb("Paragraph")))
```

Rich Message helpers only build the JSON structure. Sending it requires a Telegram
Bot API method/client that supports Rich Messages.

## API

- `K.b(text)`: bold
- `K.i(text)`: italic
- `K.un(text)`: underline
- `K.st(text)`: strikethrough
- `K.sp(text)`: spoiler
- `K.c(text)`: inline code
- `K.pre(text, lang=None)`: preformatted code
- `K.a(text, url)`: hyperlink
- `K.tg(text, user_id)`: user mention
- `K.block(text)`: blockquote
- `K.expand(text)`: expandable blockquote
- `K.table(rows, headers=None)`: monospace table
- `K.buttons(*rows)`: inline keyboard markup
- `K.btn(text, data=... or url=...)`: button specification
- `K.rb`, `K.rh`, `K.rdiv`, `K.rtable`, `K.rbutton`, `K.rbuttons`, `K.rich`, `K.rich_json`: Rich Message JSON builders
- `K.ul`, `K.ol`, `K.bullet`, `K.hr`, `K.join`, `K.plain`, `K.raw`
- `K.help()`: usage guide

Text helpers return Telegram HTML fragments. Use `parse_mode="HTML"`.
Text is escaped automatically. `K.raw()` is for trusted HTML only.
