# social.popfeed.richtext.facet

> Published by [trezy.codes](https://lexicon.garden/identity/did:plc:4jrld6fwpnwqehtce56qshzv)

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:4jrld6fwpnwqehtce56qshzv/social.popfeed.richtext.facet)
- [Documentation](https://lexicon.garden/lexicon/did:plc:4jrld6fwpnwqehtce56qshzv/social.popfeed.richtext.facet/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:4jrld6fwpnwqehtce56qshzv/social.popfeed.richtext.facet/examples)

## Definitions

### `social.popfeed.richtext.facet#tag`

**Type**: `object`

Facet feature for a hashtag. The text usually includes a '#' prefix, but the facet reference should not (except in the case of 'double hash tags').

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `tag` | `string` | Yes |  |

### `social.popfeed.richtext.facet#link`

**Type**: `object`

Facet feature for a URL. The text URL may have been simplified or truncated, but the facet reference should be a complete URL.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `uri` | `string` (uri) | Yes |  |

### `social.popfeed.richtext.facet`

**Type**: `object`

Annotation of a sub-string within rich text.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `index` | `ref` → `#byteSlice` | Yes |  |
| `features` | `array` | Yes |  |

### `social.popfeed.richtext.facet#mention`

**Type**: `object`

Facet feature for mention of another account. The text is usually a handle, including a '@' prefix, but the facet reference is a DID.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `did` | `string` (did) | Yes |  |

### `social.popfeed.richtext.facet#byteSlice`

**Type**: `object`

Specifies the sub-string range a facet feature applies to. Start index is inclusive, end index is exclusive. Indices are zero-indexed, counting bytes of the UTF-8 encoded text. NOTE: some languages, like Javascript, use UTF-16 or Unicode codepoints for string slice indexing; in these languages, convert to byte arrays before working with facets.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `byteEnd` | `integer` | Yes |  |
| `byteStart` | `integer` | Yes |  |

## Raw Schema

```json
{
  "id": "social.popfeed.richtext.facet",
  "defs": {
    "tag": {
      "type": "object",
      "required": [
        "tag"
      ],
      "properties": {
        "tag": {
          "type": "string",
          "maxLength": 640,
          "maxGraphemes": 64
        }
      },
      "description": "Facet feature for a hashtag. The text usually includes a '#' prefix, but the facet reference should not (except in the case of 'double hash tags')."
    },
    "link": {
      "type": "object",
      "required": [
        "uri"
      ],
      "properties": {
        "uri": {
          "type": "string",
          "format": "uri"
        }
      },
      "description": "Facet feature for a URL. The text URL may have been simplified or truncated, but the facet reference should be a complete URL."
    },
    "main": {
      "type": "object",
      "required": [
        "index",
        "features"
      ],
      "properties": {
        "index": {
          "ref": "#byteSlice",
          "type": "ref"
        },
        "features": {
          "type": "array",
          "items": {
            "refs": [
              "#mention",
              "#link",
              "#tag"
            ],
            "type": "union"
          }
        }
      },
      "description": "Annotation of a sub-string within rich text."
    },
    "mention": {
      "type": "object",
      "required": [
        "did"
      ],
      "properties": {
        "did": {
          "type": "string",
          "format": "did"
        }
      },
      "description": "Facet feature for mention of another account. The text is usually a handle, including a '@' prefix, but the facet reference is a DID."
    },
    "byteSlice": {
      "type": "object",
      "required": [
        "byteStart",
        "byteEnd"
      ],
      "properties": {
        "byteEnd": {
          "type": "integer",
          "minimum": 0
        },
        "byteStart": {
          "type": "integer",
          "minimum": 0
        }
      },
      "description": "Specifies the sub-string range a facet feature applies to. Start index is inclusive, end index is exclusive. Indices are zero-indexed, counting bytes of the UTF-8 encoded text. NOTE: some languages, like Javascript, use UTF-16 or Unicode codepoints for string slice indexing; in these languages, convert to byte arrays before working with facets."
    }
  },
  "$type": "com.atproto.lexicon.schema",
  "lexicon": 1
}
```
