Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bluesky publish: support @-mentions, hashtags, links #1661

Closed
snarfed opened this issue Feb 5, 2024 · 15 comments
Closed

Bluesky publish: support @-mentions, hashtags, links #1661

snarfed opened this issue Feb 5, 2024 · 15 comments
Labels

Comments

@snarfed
Copy link
Owner

snarfed commented Feb 5, 2024

Most or all of the work here is snarfed/granary#675, filing this just to track on the Bridgy side. cc @JoelOtter

@singpolyma
Copy link
Contributor

Just came here to report the @-mention thing, so glad it's known :)

@snarfed
Copy link
Owner Author

snarfed commented Feb 7, 2024

Yes!

@singpolyma out of curiosity, what does your Bluesky @-mention HTML look like?

@snarfed
Copy link
Owner Author

snarfed commented Feb 7, 2024

Thanks! Looks like it's:

@<span class="vcard"><a class="fn url" href="http://ipg.gay">ipg.gay</a></span>

A couple interesting things here. First, it links to their handle's web site directly, not their bsky.app profile URL, and second, the @ character is outside the link. Both of those make it a bit trickier to reliably/safely interpret the intent here as an @-mention and not a normal link. (As a comparison, Bridgy Fed's @-mention detection requires the @ character inside the link.)

@snarfed
Copy link
Owner Author

snarfed commented Feb 7, 2024

Apart from @-mentions specifically, I'll also echo here what I mentioned in snarfed/granary#675 in general : this is going to be difficult to implement. We have to "disassemble" span-based HTML markup into Bluesky index-based facets. For arbitrary content HTML, we have to parse it, extract just the tags we care about (currently links and microformats2 hashtag u-categories), discard other tags (including overlapping ones like the span here), extract the plain text, calculate the start and end indices of the tags we care about into the plain text, convert those indices to bytes in the HTML document's character encoding, and populate all of that into Bluesky facets. Phew.

@kevinmarks sent the old XOXO parser as an example that does this, which is great! Still though. This feels like a nontrivial project.

@singpolyma
Copy link
Contributor

singpolyma commented Feb 7, 2024 via email

@snarfed
Copy link
Owner Author

snarfed commented Feb 7, 2024

h-card/vcard is reasonable! We'd probably need a fallback, since most user-level sites/CMSes don't let people attach arbitrary classes to links, but the fallback can be expecting @ inside the link like BF does.

@kevinmarks
Copy link

kevinmarks commented Feb 7, 2024 via email

@snarfed
Copy link
Owner Author

snarfed commented Feb 7, 2024

Yup! Linking to their domain is manageable for Bridgy classic (here) because we know which specific silo you're POSSEing to. It's trickier in Bridgy Fed - which shares much of the underlying logic - because there we federate the same post to multiple networks. In that case, we wouldn't know which of those networks to try to convert this @-mention to, if any.

@singpolyma
Copy link
Contributor

singpolyma commented Feb 7, 2024 via email

@snarfed
Copy link
Owner Author

snarfed commented Feb 7, 2024

I more want to know the author's intent. May be worth discussing in #microformats.

One approach would be to try to convert to a native @-mention in each network separately. We don't necessarily know if that's what the author themselves want though? Ugh.

@JoelOtter
Copy link
Contributor

One approach would be to try to convert to a native @-mention in each network separately. We don't necessarily know if that's what the author themselves want though? Ugh.

This is something I was meaning to bring up separately. I think it is separate to this ticket though.

@snarfed
Copy link
Owner Author

snarfed commented Apr 1, 2024

@snarfed
Copy link
Owner Author

snarfed commented Oct 8, 2024

Links are working now too, shipped those a while back.

@snarfed
Copy link
Owner Author

snarfed commented Oct 8, 2024

...and @-mentions too, use a u-category link to the user's bsky.app profile URL, at:// URI to their repo or profile record, or DID.

Feel free to try, let me know if you hit any issues!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants