Skip to content

Lay out IM cards: two sentences per paragraph, spaced lists - #21

Merged
neotechnet merged 1 commit into
stack/installed-0.3.5from
feat/telegram-card-layout
Nov 12, 2026
Merged

neotechnet merged 1 commit into
stack/installed-0.3.5from
feat/telegram-card-layout

Conversation

@neotechnet

Copy link
Copy Markdown
Owner

Job DSB-CARD-FORMAT-20261112 (Igor). Steve's rule: at most two sentences per paragraph, a blank line before the first list item and between items, in every card.

Stacked on #20 (base feat/telegram-typed-answer), because both change sendCard. Retarget to stack/installed-0.3.5 once #20 merges; this PR's own diff is one commit.

What changed:

  • cardLayout in src/host/im/format.js: splits a paragraph after every second sentence, puts a blank line before the first list item and between items. Only whitespace changes.
  • A sentence boundary is .!? followed by space and a capital letter, or a CJK full stop. So decimals (17.6%), versions (v0.3.5), URLs and inline code never split; Mr., Dr., e.g., i.e. and similar do not count as ends. Fences, headings, tables and list items themselves are left as written.
  • sendCard in src/host/im/index.js lays out every card body before it is sent and recorded, so it holds for every platform and every Bot. Button labels are not touched.

Tests: 6 new in im-format.test.js and 1 in im.test.js; the options-view text assertion updated to the new layout. 3 test groups fail on the unpatched source.

Not done: option descriptions inside a list item are not split (splitting would break the item). No smoke bench, no live Telegram run, profile untouched.

Cards reached chat apps as walls of text: long questions ran on, and the option list started on the line straight after the question. sendCard now lays every card out before it is sent and recorded, whichever Bot wrote it: a paragraph of more than two sentences breaks after every second sentence, and a list gets a blank line before its first item and between items. Only whitespace changes. Decimals, versions, URLs, inline code, common abbreviations, fences, headings, tables and the list items themselves are left as written; button labels are not touched.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-12T17:22:37.824981Z 50c1857 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 50c18574ad

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +309 to +310
if (piece.ends && count === 2) {
out += '\n\n'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve inline Markdown when inserting paragraph breaks

When a card contains a multi-sentence Markdown link or emphasized span, the inserted blank line can split that construct across blocks and break its rendering. For example, First sentence. [Second sentence. Third sentence.](https://example.com) gains a blank line inside the link label; passing the result through toTelegramHtml now emits literal Markdown instead of a clickable link. Likewise, **First sentence. Second sentence. Third sentence.** loses its bold formatting. Since sendCard now applies this transformation to every card, preserve inline Markdown constructs by avoiding breaks inside them or closing and reopening supported formatting around each break.

Useful? React with 👍 / 👎.

@neotechnet
neotechnet changed the base branch from feat/telegram-typed-answer to stack/installed-0.3.5 November 12, 2026 17:31
@neotechnet
neotechnet merged commit 6204da4 into stack/installed-0.3.5 Nov 12, 2026
14 checks passed
@neotechnet
neotechnet deleted the feat/telegram-card-layout branch November 12, 2026 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant