Repository navigation
Lay out IM cards: two sentences per paragraph, spaced lists - #21
Conversation
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.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 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".
| if (piece.ends && count === 2) { | ||
| out += '\n\n' |
There was a problem hiding this comment.
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 👍 / 👎.
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 changesendCard. Retarget tostack/installed-0.3.5once #20 merges; this PR's own diff is one commit.What changed:
cardLayoutinsrc/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..!?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.sendCardinsrc/host/im/index.jslays 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.jsand 1 inim.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.