Skip to content

fix(whatsapp): preserve literal text during formatting - #909

Open
luksch42 wants to merge 3 commits into
vercel:mainfrom
luksch42:fix/whatsapp-literal-formatting
Open

luksch42 wants to merge 3 commits into
vercel:mainfrom
luksch42:fix/whatsapp-literal-formatting

Conversation

@luksch42

@luksch42 luksch42 commented Sep 6, 2026

Copy link
Copy Markdown

Summary

Fixes #908.

Outgoing WhatsApp Markdown such as (~80 % easy) currently becomes (\~80 % easy), leaving a visible backslash in the delivered message. Render literal text, bold, and strikethrough directly from the Markdown AST so literal tildes and intentional backslashes are preserved, and formatting markers inside inline and fenced code remain unchanged.

Expose typed serialization handlers in stringifyMarkdown and provide lookahead markers to avoid repeated subtree serialization for deeply nested formatting. Includes regression tests, patch changesets, and documentation updates.

Test plan

  • pnpm validate passes (knip, lint/format, typecheck, tests, and build).
  • pnpm konsistent passes.
  • pnpm changeset status recognizes the patch changesets.
  • Regression coverage includes literal tildes, intentional backslashes, escaped markers, inline/fenced code, lists, and nested formatting, including a deep-nesting performance check.

Checklist

  • All commits are signed and verified
  • All commits are signed off for the DCO (git commit -s)
  • pnpm validate passes
  • Changeset added
  • Documentation updated

Render literal text and WhatsApp formatting directly from the Markdown AST, preserving code content and intentional backslashes.

Signed-off-by: Lukas Scholten <46937006+luksch42@users.noreply.github.com>
Add serializer lookahead markers and a regression test for deeply nested formatting.

Signed-off-by: Lukas Scholten <46937006+luksch42@users.noreply.github.com>
@luksch42
luksch42 requested a review from a team as a code owner September 6, 2026 15:34
@vercel

vercel Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

@luksch42 is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
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.

WhatsApp adapter adds visible backslashes before literal tildes

1 participant