Skip to content

Link text in a post’s HTML isn’t clickable on Bluesky #948

Description

@rmdes

Bluesky has no markup: a post is plain text plus facets, byte ranges that carry a link, mention or tag. createRichText in packages/syndicator-bluesky/lib/utils.js calls RichText#detectFacets, which only recognises URLs written out in the text. htmlToStatusText keeps the text of every <a> but drops its href (it appends the last link’s URL to the end of the status as a workaround), so a post like

<p>I like <a href="https://cheese.example">cheese</a>.</p>

reaches Bluesky as “I like cheese. https://cheese.example”, where the word “cheese” is plain text. With two or more links in a post, only the last URL survives at all.

Reproduce: syndicate the post above and fetch the created record: facets holds one link facet, for the trailing URL, none for “cheese”. (A test on @atproto/dev-env’s test network fails on main this way.)

Fix: read the links from the HTML, find each link’s text in the final post text, and add a link facet with the byte range for it, skipping any that overlap a facet Bluesky already detected. Byte offsets, not character offsets, per the richtext guide. The appended last URL is left as it is. PR to follow.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions