fix: handle nested formatting markers in markdownToSignal #1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/nested-formatting-markers"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fix
markdownToSignalso nested formatting markers (e.g., inline code inside bold, italic inside bold, triple-asterisk bold+italic, inline code inside a header) no longer leak literal marker names (BOLD/ITALIC/MONO) and SOH/STX control bytes into the visible Signal message body.Type of Change
Changes Made
src/delivery.tswith a stack-based walker that pushes a style frame on each opener and pops on each closer, producing overlappingBodyRangesthat match Signal's protobuf semantics.tests/delivery.test.ts, each asserting the output contains no SOH (\u0001) or STX (\u0002) control characters.Testing
npm test— 63/63 passing)npm run lintclean)Checklist
Notes
The previous regex pass was non-greedy and closed the outer marker on the first inner closer, leaving the inner marker name and control bytes in the visible body whenever formatting was nested. The stack-based walker handles arbitrary nesting depth while preserving the overlapping byte-offset ranges that Signal's
textStyleprotobuf semantics require.3c16e3e5f994376f436f94376f436fbcb5ceefbebcb5ceefbe7b97edd43f