Skip to content

Preserve link destinations in X post text - #555

Open
cu-min wants to merge 1 commit into
kepano:mainfrom
cu-min:fix/twitter-post-link-destinations
Open

cu-min wants to merge 1 commit into
kepano:mainfrom
cu-min:fix/twitter-post-link-destinations

Conversation

@cu-min

@cu-min cu-min commented Dec 2, 2026

Copy link
Copy Markdown

Summary

Clipping an X post now keeps the full link destination in HTML and Markdown, even when X shortens the visible label with an ellipsis.

Root cause

TwitterExtractor.formatTweetText() replaced every anchor with its text content. Once the extractor discarded the href, the Markdown converter had only the display label.

Reproduction

Clip a post containing <a href="https://example.org/docs/full-article">example.org/docs/…</a>. Previously the output contained only example.org/docs/…. The regression fixture expects [example.org/docs/…](https://example.org/docs/full-article).

Changes

Rebuild ordinary links from their label and safe href. Keep mentions, hashtags, and cashtags as plain text. The offline fixture checks a shortened link alongside an @mention.

Verification

  • Reproduced the failure on main. The fixture passes with linkedom and JSDOM, both browser bundles in Chrome, and the local Worker.
  • Both full suites passed all 2,102 tests with two workers. The JSDOM run preloaded jsdom. Unrestricted Windows runs hit timing failures in the CLI and C2 Wiki tests.
  • Build, bundle budgets, unused-local checks, and extractor-name checks passed. The security lint reports the same three allowlisted lines on Windows as on main and passes with POSIX-style relative paths.

Fixes #550

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.

X/Twitter: links in post text are saved truncated (display text only, href dropped)

1 participant