···5858 element.text(model.string),
5959 // Let's render comments under https://pony.social/@strawmelonjuice/115911235653686237
6060 chilp.widget(
6161- option.Some(anchors.Mastodon(
6262- instance: "pony.social",
6363- postid: "115911235653686237",
6161+ // A post on a sharkey instance
6262+ mastodon: option.Some(anchors.Mastodon(
6363+ instance: "procial.tchncs.de",
6464+ postid: "alf5j0fozrnl0002",
6465 )),
6565- option.Some(anchors.Bluesky(
6666+ // A post on a regular instance
6767+ // mastodon: option.Some(anchors.Mastodon(
6868+ // instance: "pony.social",
6969+ // postid: "115911235653686237",
7070+ // )),
7171+ bluesky: option.Some(anchors.Bluesky(
6672 did: "did:plc:tydnkicz4pafvkt3jspzldn6",
6773 postid: "3mhwwbldyjc2o",
6874 )),
+46-1
src/chilp.gleam
···11import chilp/widget
22+import chilp/widget/anchors
33+import gleam/option.{type Option}
44+55+/// An anchor to the Bluesky post you want to
66+/// fetch comments from.
77+/// | Parameter | Description |
88+/// | --------- | ----------- |
99+/// | `did` | Your DID, for `@strawmelonjuice.com`, this looks like `"did:plc:jgtfsmv25thfs4zmydtbccnn"`.<br><br>Not sure how to find your DID? <https://bsky-did.neocities.org> is one of the many places where you can easily find it. |
1010+/// | `post_id` | A post id to bind to, you'll find this in a post url `https://bsky.app/profile/<your-username-or-did>/post/[postid]` |
1111+///
1212+///
1313+/// You can also construct this directly if you import `chilp/widget/anchors`.
1414+pub fn bluesky(did did: String, post_id postid: String) {
1515+ anchors.Bluesky(did:, postid:)
1616+}
1717+1818+///
1919+/// An anchor to the Fediverse post you want to
2020+/// fetch comments from.
2121+/// | Parameter | Description |
2222+/// | ---------- | ----------- |
2323+/// | `instance` | The instance name, e.g. `"mastodon.social"`, this is where your post is stored, and where chilp will attempt to fetch it from. |
2424+/// | `post_id` | A post id to bind to, you'll find this in a post url `https://instance.social/@<username>/[postid]`. |
2525+/// | | On Sharkey or Misskey this is a note id, found `https://instance.social/notes/[note-id]` |
2626+///
2727+/// You can also construct this directly if you import `chilp/widget/anchors`.
2828+pub fn mastodon(instance instance: String, post_id postid: String) {
2929+ anchors.Mastodon(instance:, postid:)
3030+}
231332/// Widget component!
433/// Before adding this component make sure to call `widget.register()` to register it!
534///
66-pub const widget = widget.element
3535+/// Little example:
3636+/// ```gleam
3737+/// chilp.widget(
3838+/// // We connect to Bluesky...
3939+/// bluesky: option.Some(chilp.bluesky("did:plc:my-did","myPostId")),
4040+/// // ...But not to Mastodon? Sure! Make it a None!
4141+/// mastodon: option.None
4242+/// )
4343+/// ```
4444+///
4545+/// You can also construct this directly if you import `chilp/widget`.
4646+pub fn widget(
4747+ bluesky bsky: Option(anchors.Bluesky),
4848+ mastodon masto: Option(anchors.Mastodon),
4949+) {
5050+ widget.element(masto, bsky)
5151+}