2.0.3 • Published 6 months ago

@atcute/bluesky-richtext-segmenter v2.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
6 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',
			},
		],
	},
]);
2.0.3

6 months ago

2.0.2

6 months ago

1.0.5

1 year ago

2.0.1

7 months ago

1.0.4

1 year ago

2.0.0

8 months ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago