Repository navigation
feat(send): send rich messages from Markdown or HTML - #175
Merged
neoromantic merged 4 commits intoNov 18, 2026
Merged
Conversation
tg send --markdown and --html pass --message to Telegram as a rich message, which it parses itself: headings, tables, lists and task lists, quotations, code blocks, details, formulas and footnotes, next to the inline styles. The result says which in format, and a message Telegram refuses names its reason with the limits as the suggestion. Captions stay plain text: a rich message can't be one. Co-Authored-By: Claude Fable 5.2 <[email protected]>
This was referenced Nov 18, 2026
Merged
CHANGELOG: both sides' entries kept. Co-Authored-By: Claude Fable 5.2 <[email protected]>
main now has neoromantic#179 (neoromantic#188). No conflict. Co-Authored-By: Claude Fable 5.2 <[email protected]>
main is now the 0.14.0 release (neoromantic#189). This PR's changelog entries move back under Unreleased: a plain merge left them in the released section. Co-Authored-By: Claude Fable 5.2 <[email protected]>
neoromantic
added a commit
that referenced
this pull request
Nov 18, 2026
feat(send): send rich messages from Markdown or HTML (#175)
ertembiyik
added a commit
to ertembiyik/telegram-sync-cli
that referenced
this pull request
Nov 18, 2026
main now has neoromantic#175 (neoromantic#194), neoromantic#174 and neoromantic#155. fetch.ts: the batch fetch is built on main's shared fetchMessagesByIdRaw, with the peer check kept. README and CHANGELOG: both sides' entries kept. Co-Authored-By: Claude Fable 5.2 <[email protected]>
ertembiyik
added a commit
to ertembiyik/telegram-sync-cli
that referenced
this pull request
Nov 18, 2026
main now has neoromantic#175 (neoromantic#194), neoromantic#174 and neoromantic#155. README and CHANGELOG: both sides kept. main dropped MessagesHistory.getMany (neoromantic#174): the item is read with get. Fixture groups take part in the tests: main caches a group's new messages only while the account writes there (neoromantic#155). Co-Authored-By: Claude Fable 5.2 <[email protected]>
ertembiyik
added a commit
to ertembiyik/telegram-sync-cli
that referenced
this pull request
Nov 18, 2026
main now has neoromantic#175 (neoromantic#194), neoromantic#174 and neoromantic#155. README and CHANGELOG: both sides kept. Fixture groups take part in the tests: main caches a group's new messages only while the account writes there (neoromantic#155). Co-Authored-By: Claude Fable 5.2 <[email protected]>
ertembiyik
added a commit
to ertembiyik/telegram-sync-cli
that referenced
this pull request
Nov 18, 2026
main now has neoromantic#175 (neoromantic#194), neoromantic#174 and neoromantic#155. README and CHANGELOG: both sides kept. main dropped MessagesHistory.getMany (neoromantic#174): the item is read with get. Fixture groups take part in the tests: main caches a group's new messages only while the account writes there (neoromantic#155). Co-Authored-By: Claude Fable 5.2 <[email protected]>
ertembiyik
added a commit
to ertembiyik/telegram-sync-cli
that referenced
this pull request
Nov 18, 2026
main now has neoromantic#175 (neoromantic#194), neoromantic#174 and neoromantic#155. README and CHANGELOG: both sides kept. main dropped MessagesHistory.getMany (neoromantic#174): the item is read with get. Fixture groups take part in the tests: main caches a group's new messages only while the account writes there (neoromantic#155). Co-Authored-By: Claude Fable 5.2 <[email protected]>
ertembiyik
added a commit
to ertembiyik/telegram-sync-cli
that referenced
this pull request
Nov 18, 2026
main now has neoromantic#175 (neoromantic#194), neoromantic#174 and neoromantic#155. history.ts and two test files: imports of both sides. CHANGELOG: both sides kept. Fixture groups take part in the tests: main caches a group's new messages only while the account writes there (neoromantic#155). Co-Authored-By: Claude Fable 5.2 <[email protected]>
ertembiyik
added a commit
to ertembiyik/telegram-sync-cli
that referenced
this pull request
Nov 18, 2026
main now has neoromantic#175 (neoromantic#194), neoromantic#174 and neoromantic#155. skill.ts: main's shared getErrorMessage, the manifest stays removed. CHANGELOG: both sides kept. Fixture groups take part in the tests: main caches a group's new messages only while the account writes there (neoromantic#155). Co-Authored-By: Claude Fable 5.2 <[email protected]>
ertembiyik
added a commit
to ertembiyik/telegram-sync-cli
that referenced
this pull request
Nov 18, 2026
main now has neoromantic#175 (neoromantic#194), neoromantic#174 and neoromantic#155. helpers.ts: the item reader takes main's raw string, with the transcript kept. sql.test.ts uses main's cache helper. CHANGELOG: both sides kept. Co-Authored-By: Claude Fable 5.2 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
tg sendcould only send plain text, so an agent asked to send a table or a formatted report sent a screenshot of one. Telegram's API now takes rich messages, and it parses Markdown or HTML itself, sotg send --markdownandtg send --htmlpass--messagethrough as a rich message: headings, tables, lists and task lists, quotations, code blocks, collapsible details, formulas and footnotes, next to bold, italic, links and the other inline styles.Before: the text arrives as written, asterisks and pipes included.
After: the same text with
--markdownarrives as a heading and a real table.The result gains
format("markdown","html", ornullfor plain text). When Telegram refuses the message the error names its reason and the limits. This is the real output for a table with 21 columns:{ "success": false, "error": { "code": "TELEGRAM_ERROR", "message": "Telegram refused the rich message: RICH_MESSAGE_TABLE_COLS_TOO_MANY", "details": { "telegramError": "RICH_MESSAGE_TABLE_COLS_TOO_MANY" }, "suggestion": "A rich message takes up to 32768 characters, 500 blocks, 16 levels of nesting, 50 media and 20 table columns" } }How it works:
messages.sendMessage, withmessage: ""andrichMessageset toinputRichMessageMarkdownorinputRichMessageHTML. Telegram does the parsing, sotghas no parser of its own and supports whatever the syntax supports (Markdown, HTML).--markdownwith--html, or either with--file, isINVALID_ARGSbefore any connection. A caption can't be a rich message, so captions stay plain text.Decisions you may want to change:
--format <markdown|html>, because--formatis already the output format.--markdown -m '**hi**'sends a one-paragraph rich message, not a plain message with a bold entity. That keeps one syntax (Telegram's) and no parser intg. A plain message with entities, and formatted captions, would need mtcute's parsers, whose Markdown differs from Telegram's; I left that for a separate change if you want it.Not in this PR, and worth knowing:
tg messagesprints a rich message withtext: null, because its content is inrichMessage, not inmessage. That affects received rich messages as well as the ones this flag sends. I have a fix for the reading side ready to send separately.Update:
mainmerged in (16dbd92, the 0.14.0 release)CHANGELOG.mdonly; both sides' entries are kept.retryable.## [Unreleased]again: the release moved everything that was there into 0.14.0.bun run checkclean,bun run test2354 pass,bun run test:e2e455 pass, 0 fail.How I checked it
Unit tests in
src/__tests__/send.test.tswith the mocked client: the request for--markdownand for--html, plain text unchanged, the three argument errors, and the refusal error with its suggestion.E2E in
src/__e2e__/send-file.e2e.test.ts: the argument errors, checked before any connection.Live, on a personal account, to Saved Messages only: a Markdown message came back as a rich message with heading, paragraph, table, list, blockquote and preformatted blocks; an HTML one with a table, an ordered list, a pull quote and details. A 21-column table and an empty message were refused with
RICH_MESSAGE_TABLE_COLS_TOO_MANYandRICH_MESSAGE_EMPTY. Malformed HTML (an unclosed tag) still sent. I did not test sending to other people, groups or channels.bun run check: clean.bun run test: 2308 pass, 0 fail.bun run test:e2e: 433 pass, 0 fail.Tests pass locally and use made-up data only
README, docs and affected demos follow the product content standard (
docs/cli-commands.md, README feature list and comparison row, CHANGELOG)Title follows the repo's commit style: Conventional Commits (
feat: …,fix: …) unlessAGENTS.mdsays otherwise🤖 Generated with Claude Code