gmail: strip Outlook reply headers without inline <b>/<strong> wrappers#152
Merged
Conversation
The existing quoted-reply regex required each "From:/Sent:/To:/Subject:" field label to be wrapped in <b> or <strong>. Corporate Exchange and Outlook variants (Gowling-style MsoNormal, <span style="font-weight:bold">, plain <font> headers) don't use those tags, so reply chains leaked into the synced note. Add a tag-agnostic fallback that replaces every HTML tag with a same-length whitespace run (offsets stay aligned with the original) and anchors each label at a structural boundary — start-of-string, a real newline, or 3+ whitespace chars (the smallest gap any block tag produces when collapsed). That anchor keeps user prose that mentions From/Sent/To/Subject inline from false-matching. Co-Authored-By: Claude Opus 4.7 (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.
Summary
stripQuotedReplypreviously required each "From:/Sent:/To:/Subject:" label to be wrapped in<b>or<strong>. Corporate Exchange/Outlook variants (e.g. Gowling-styleMsoNormal,<span style="font-weight:bold">, plain<font>headers) don't use those tags, so reply chains leaked into synced notes.findOutlookHeaderTagAgnostic()that replaces every HTML tag with same-length whitespace (offsets stay aligned with the original) and anchors each label at a structural boundary — start-of-string, a real newline, or 3+ whitespace chars (the smallest gap any block tag produces when collapsed). That anchor keeps user prose mentioning From/Sent/To/Subject inline from false-matching.Test plan
workers/api/src/twist/tools/__tests__/gmail-quote-strip.test.tsin the parent repo covers bold-wrapped, no-inline-bold,<span style="font-weight:bold">, and prose false-positive cases — 6 tests, all green).🤖 Generated with Claude Code