feat: render iMessage text decorations from {decoration:content} markup#14
Open
pdsullivan wants to merge 1 commit into
Open
feat: render iMessage text decorations from {decoration:content} markup#14pdsullivan wants to merge 1 commit into
pdsullivan wants to merge 1 commit into
Conversation
The system prompt already teaches Claude to style/animate words with
{bold:...}, {shake:...}, etc., but nothing parsed that markup — it was
sent to users as literal braces. This wires up the rendering path.
- src/text/decorations.ts: parseDecorations() converts {name:content}
markup into plain text + a text_decorations[] array (ranges + style/
animation). processResponse() applies it for iMessage and strips the
markup entirely for SMS/RCS (which can't render decorations).
- src/linq/client.ts: sendMessage() accepts optional textDecorations and
attaches them to the text message part (text_decorations).
- src/index.ts: routes each outgoing message through processResponse()
based on the channel, replacing the old inline cleanResponse().
- decorations.test.ts: 32 tests covering parsing, range math, channel
behavior, and edge cases (overlap, unknown names, emoji, adjacency).
- package.json: add `test` script (tsx --test).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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
The system prompt already instructs Claude to style and animate words using
{bold:...},{shake:...},{explode:...}, etc. (iMessage text decorations), but nothing parsed that markup — so users saw literal braces in the message. This PR wires up the actual rendering path.Changes
src/text/decorations.tsparseDecorations()— converts{name:content}markup into plain text plus atext_decorations[]array (character ranges +style/animation). Handles overlap (first match wins), unknown names (left as-is), emoji, and adjacency.processResponse(text, isIMessage)— for iMessage, parses decorations and cleans up whitespace quirks while keeping ranges aligned; for SMS/RCS, strips the markup entirely (those channels can't render decorations).src/linq/client.ts—sendMessage()takes an optionaltextDecorationsarg and attaches it to the text message part (text_decorations). AddsTextDecoration/ style / animation types.src/index.ts— routes each outgoing message throughprocessResponse()based on channel, replacing the old inlinecleanResponse().src/text/decorations.test.ts— 32 tests (parsing, range math, per-channel behavior, edge cases).package.json— addstestscript (tsx --test).Test plan
npm run buildpassesnpm test— 32/32 passNote
Independent of #13 (the Sonnet 4.6 hotfix) — separate concern, separate branch off
main.