Methods
build()
Completes the rich text string and returns the result, with parsed facets and the length of the string in graphemes.
Returns
{ facets: AppBskyRichtextFacet.Main[]; length: number; text: string; }
link(substr, uri?)
Append a link.
You can use the
parameter to specify a different URI than the uri
.substr
Create a hyperlink
new RichText().text("Go to ").link("https://bsky.app").build();
Create a hyperlink with custom text
new RichText().text("Go to ").link("Bluesky", "https://bsky.app").build();
Parameters
substr: string
uri: string = substr
Returns
this
detectFacets(text, bot)
Returns a RichText instance with all facets (mentions, links, tags, etc) resolved.
Returns
Promise<AppBskyRichtextFacet.Main[]>
detectFacetsWithoutResolution(text)
Detects rich text facets in a string (mentions, links, tags, etc). Will produce invalid facets! For instance, mentions will not have their DIDs set. Use detectFacets to produce valid facets that can be attached to a post.