Skip to content

Commit 1000b93

Browse files
authored
Merge pull request #136 from hypercerts-org/richtext-changeset
chore(sdk-core): enhance RichText changeset with versioning note and usage examples
2 parents 935769e + a2b7074 commit 1000b93

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

.changeset/add-richtext-utility.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,24 @@
44

55
Add RichText utility functions for auto-detecting facets from text
66

7+
**0.x Versioning Note:** This is a non-breaking addition. No existing APIs are modified or removed.
8+
79
New utility functions to simplify creating rich text facets:
810

911
- `createFacetsFromText(text, agent?)` - async function that auto-detects URLs, hashtags, and @mentions. If an agent is
10-
provided, resolves mentions to DIDs.
11-
- `createFacetsFromTextSync(text)` - sync function for fast detection without mention resolution
12+
provided, resolves mentions to DIDs; otherwise mentions use the handle string as the DID.
13+
- `createFacetsFromTextSync(text)` - sync function for fast detection without mention resolution (mentions use handle as
14+
DID)
1215
- Re-exports `RichText` class from `@atproto/api` for advanced use cases
16+
17+
**Usage:**
18+
19+
```typescript
20+
import { createFacetsFromText, createFacetsFromTextSync } from "@hypercerts-org/sdk-core";
21+
22+
// Sync (no DID resolution)
23+
const facetsSync = createFacetsFromTextSync("Check out #hypercerts by @alice");
24+
25+
// Async with DID resolution (requires authenticated agent)
26+
const facetsAsync = await createFacetsFromText("Check out #hypercerts by @alice", agent);
27+
```

0 commit comments

Comments
 (0)