1.0.2 • Published 9 months ago

@atcute/bluesky-richtext-segmenter v1.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

@atcute/bluesky-richtext-segmenter

segments Bluesky's rich text facets into tokens.

const result = segmentize('hello @bsky.app! check out my website', [
	{
		index: { byteStart: 6, byteEnd: 15 },
		features: [
			{
				$type: 'app.bsky.richtext.facet#mention',
				did: 'did:plc:z72i7hdynmk6r22z27h6tvur',
			},
		],
	},
	{
		index: { byteStart: 30, byteEnd: 37 },
		features: [
			{
				$type: 'app.bsky.richtext.facet#link',
				uri: 'https://example.com',
			},
		],
	},
]);

expect(result).toEqual([
	{
		text: 'hello ',
		features: undefined,
	},
	{
		text: '@bsky.app',
		features: [
			{
				$type: 'app.bsky.richtext.facet#mention',
				did: 'did:plc:z72i7hdynmk6r22z27h6tvur',
			},
		],
	},
	{
		text: '! check out my ',
		features: undefined,
	},
	{
		text: 'website',
		features: [
			{
				$type: 'app.bsky.richtext.facet#link',
				uri: 'https://example.com',
			},
		],
	},
]);
1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago