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

fix: Bluesky embed hashtag links broken #178

Merged
merged 2 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/clean-falcons-remain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@astro-community/astro-embed-bluesky": patch
---

Fixes hashtag links in Bluesky embeds
2 changes: 1 addition & 1 deletion packages/astro-embed-bluesky/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
if (!post) {
return '';
}
const rt = new RichText(post.record as any);

Check warning on line 28 in packages/astro-embed-bluesky/src/utils.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
let html = '';
for (const segment of rt.segments()) {
if (segment.isLink()) {
Expand All @@ -37,7 +37,7 @@
segment.mention?.did
)}">${escapeHTML(segment.text)}</a>`;
} else if (segment.isTag()) {
html += `<a href="https://bsky.app/hastag/${escapeHTML(
html += `<a href="https://bsky.app/hashtag/${escapeHTML(
segment.tag?.tag
)}">#${escapeHTML(segment.tag?.tag)}</a>`;
} else {
Expand Down Expand Up @@ -118,7 +118,7 @@
return undefined;
}
did = handleResolution.data.did;
} catch (e: any) {

Check warning on line 121 in packages/astro-embed-bluesky/src/utils.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
console.error(
`[error] astro-embed` + '\n ' + (e?.message ?? e)
);
Expand All @@ -132,7 +132,7 @@
try {
const hydratedPost = await agent.getPosts({ uris: [atUri] });
return hydratedPost.data.posts[0] as unknown as Post;
} catch (e: any) {

Check warning on line 135 in packages/astro-embed-bluesky/src/utils.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
console.error(`[error] astro-embed` + '\n ' + (e?.message ?? e));
return undefined;
}
Expand Down
Loading