# pub.chive.richtext.defs

> Published by [chive.pub](https://lexicon.garden/identity/did:plc:7natp5xae72bddaqlkef2t4e)

✓ This is the authoritative definition for this NSID.

## Description

Shared definitions for unified rich text in Chive. All rich text content (abstracts, review bodies, annotation bodies, titles) references these types.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:7natp5xae72bddaqlkef2t4e/pub.chive.richtext.defs)
- [Documentation](https://lexicon.garden/lexicon/did:plc:7natp5xae72bddaqlkef2t4e/pub.chive.richtext.defs/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:7natp5xae72bddaqlkef2t4e/pub.chive.richtext.defs/examples)

## Definitions

### `pub.chive.richtext.defs#facet`

**Type**: `object`

ATProto-compatible facet for rich text formatting within a text item

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

### `pub.chive.richtext.defs#tagItem`

**Type**: `object`

Hashtag reference

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `tag` | `string` | Yes | Tag without # prefix |
| `type` | `string` | Yes |  |

### `pub.chive.richtext.defs#linkItem`

**Type**: `object`

Inline hyperlink

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `url` | `string` (uri) | Yes |  |
| `type` | `string` | Yes |  |
| `label` | `string` | No |  |

### `pub.chive.richtext.defs#listItem`

**Type**: `object`

List item

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `string` | Yes |  |
| `depth` | `integer` | No |  |
| `content` | `string` | Yes |  |
| `ordinal` | `integer` | No |  |
| `listType` | `string` | Yes |  |

### `pub.chive.richtext.defs#textItem`

**Type**: `object`

Plain text content item with optional formatting facets

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `string` | Yes |  |
| `facets` | `array` | No | ATProto-style facets for rich text formatting |
| `content` | `string` | Yes | Text content |

### `pub.chive.richtext.defs#byteSlice`

**Type**: `object`

Byte range for facet positioning

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `byteEnd` | `integer` | Yes | End byte position (exclusive) |
| `byteStart` | `integer` | Yes | Start byte position (inclusive) |

### `pub.chive.richtext.defs#latexItem`

**Type**: `object`

Standalone LaTeX math expression

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `string` | Yes |  |
| `content` | `string` | Yes |  |
| `displayMode` | `boolean` | No | True for block display ($$...$$), false for inline ($...$) |

### `pub.chive.richtext.defs#linkFacet`

**Type**: `object`

Hyperlink facet

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `uri` | `string` (uri) | Yes | Link target URL |
| `$type` | `string` | Yes |  |

### `pub.chive.richtext.defs#headingItem`

**Type**: `object`

Heading (for abstracts and reviews, not titles)

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `string` | Yes |  |
| `level` | `integer` | Yes |  |
| `content` | `string` | Yes |  |

### `pub.chive.richtext.defs#mentionItem`

**Type**: `object`

ATProto-style mention (@handle)

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `did` | `string` (did) | Yes |  |
| `type` | `string` | Yes |  |
| `handle` | `string` | No | Handle at time of mention |

### `pub.chive.richtext.defs#nodeRefItem`

**Type**: `object`

Knowledge graph node reference

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `uri` | `string` (at-uri) | Yes | AT-URI of the referenced node |
| `type` | `string` | Yes |  |
| `label` | `string` | No | Display label (cached from node) |
| `subkind` | `string` | No | Node subkind slug for styling (field, institution, person, etc.) |

### `pub.chive.richtext.defs#facetRefItem`

**Type**: `object`

Facet classification node reference

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `uri` | `string` (at-uri) | Yes |  |
| `type` | `string` | Yes |  |
| `label` | `string` | No |  |

### `pub.chive.richtext.defs#fieldRefItem`

**Type**: `object`

Academic field node reference

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `uri` | `string` (at-uri) | Yes |  |
| `type` | `string` | Yes |  |
| `label` | `string` | No |  |

### `pub.chive.richtext.defs#authorRefItem`

**Type**: `object`

Reference to an author by DID

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `did` | `string` (did) | Yes |  |
| `type` | `string` | Yes |  |
| `label` | `string` | No | Display name |

### `pub.chive.richtext.defs#codeBlockItem`

**Type**: `object`

Code block

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `string` | Yes |  |
| `content` | `string` | Yes |  |
| `language` | `string` | No |  |

### `pub.chive.richtext.defs#eprintRefItem`

**Type**: `object`

Reference to another eprint

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `uri` | `string` (at-uri) | Yes |  |
| `type` | `string` | Yes |  |
| `label` | `string` | No | Eprint title for display |

### `pub.chive.richtext.defs#blockquoteItem`

**Type**: `object`

Blockquote

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `string` | Yes |  |
| `content` | `string` | Yes |  |

### `pub.chive.richtext.defs#wikidataRefItem`

**Type**: `object`

Wikidata entity reference

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `qid` | `string` | Yes | Wikidata QID (e.g., Q12345) |
| `type` | `string` | Yes |  |
| `label` | `string` | No | Display label |

### `pub.chive.richtext.defs#annotationRefItem`

**Type**: `object`

Reference to an annotation or review

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `uri` | `string` (at-uri) | Yes |  |
| `type` | `string` | Yes |  |
| `label` | `string` | No | Text excerpt for preview |

## Raw Schema

```json
{
  "id": "pub.chive.richtext.defs",
  "defs": {
    "facet": {
      "type": "object",
      "required": [
        "index",
        "features"
      ],
      "properties": {
        "index": {
          "ref": "#byteSlice",
          "type": "ref"
        },
        "features": {
          "type": "array",
          "items": {
            "refs": [
              "pub.chive.richtext.facets#bold",
              "pub.chive.richtext.facets#italic",
              "pub.chive.richtext.facets#strikethrough",
              "pub.chive.richtext.facets#code",
              "pub.chive.richtext.facets#latex",
              "#linkFacet"
            ],
            "type": "union"
          }
        }
      },
      "description": "ATProto-compatible facet for rich text formatting within a text item"
    },
    "tagItem": {
      "type": "object",
      "required": [
        "type",
        "tag"
      ],
      "properties": {
        "tag": {
          "type": "string",
          "maxLength": 100,
          "description": "Tag without # prefix"
        },
        "type": {
          "type": "string",
          "const": "tag"
        }
      },
      "description": "Hashtag reference"
    },
    "linkItem": {
      "type": "object",
      "required": [
        "type",
        "url"
      ],
      "properties": {
        "url": {
          "type": "string",
          "format": "uri"
        },
        "type": {
          "type": "string",
          "const": "link"
        },
        "label": {
          "type": "string",
          "maxLength": 500
        }
      },
      "description": "Inline hyperlink"
    },
    "listItem": {
      "type": "object",
      "required": [
        "type",
        "content",
        "listType"
      ],
      "properties": {
        "type": {
          "type": "string",
          "const": "listItem"
        },
        "depth": {
          "type": "integer",
          "maximum": 5,
          "minimum": 0
        },
        "content": {
          "type": "string",
          "maxLength": 2000
        },
        "ordinal": {
          "type": "integer",
          "minimum": 1
        },
        "listType": {
          "type": "string",
          "knownValues": [
            "bullet",
            "ordered"
          ]
        }
      },
      "description": "List item"
    },
    "textItem": {
      "type": "object",
      "required": [
        "type",
        "content"
      ],
      "properties": {
        "type": {
          "type": "string",
          "const": "text"
        },
        "facets": {
          "type": "array",
          "items": {
            "ref": "#facet",
            "type": "ref"
          },
          "maxLength": 500,
          "description": "ATProto-style facets for rich text formatting"
        },
        "content": {
          "type": "string",
          "maxLength": 100000,
          "description": "Text content",
          "maxGraphemes": 50000
        }
      },
      "description": "Plain text content item with optional formatting facets"
    },
    "byteSlice": {
      "type": "object",
      "required": [
        "byteStart",
        "byteEnd"
      ],
      "properties": {
        "byteEnd": {
          "type": "integer",
          "minimum": 0,
          "description": "End byte position (exclusive)"
        },
        "byteStart": {
          "type": "integer",
          "minimum": 0,
          "description": "Start byte position (inclusive)"
        }
      },
      "description": "Byte range for facet positioning"
    },
    "latexItem": {
      "type": "object",
      "required": [
        "type",
        "content"
      ],
      "properties": {
        "type": {
          "type": "string",
          "const": "latex"
        },
        "content": {
          "type": "string",
          "maxLength": 5000
        },
        "displayMode": {
          "type": "boolean",
          "description": "True for block display ($$...$$), false for inline ($...$)"
        }
      },
      "description": "Standalone LaTeX math expression"
    },
    "linkFacet": {
      "type": "object",
      "required": [
        "$type",
        "uri"
      ],
      "properties": {
        "uri": {
          "type": "string",
          "format": "uri",
          "description": "Link target URL"
        },
        "$type": {
          "type": "string",
          "const": "app.bsky.richtext.facet#link"
        }
      },
      "description": "Hyperlink facet"
    },
    "headingItem": {
      "type": "object",
      "required": [
        "type",
        "content",
        "level"
      ],
      "properties": {
        "type": {
          "type": "string",
          "const": "heading"
        },
        "level": {
          "type": "integer",
          "maximum": 6,
          "minimum": 1
        },
        "content": {
          "type": "string",
          "maxLength": 500
        }
      },
      "description": "Heading (for abstracts and reviews, not titles)"
    },
    "mentionItem": {
      "type": "object",
      "required": [
        "type",
        "did"
      ],
      "properties": {
        "did": {
          "type": "string",
          "format": "did"
        },
        "type": {
          "type": "string",
          "const": "mention"
        },
        "handle": {
          "type": "string",
          "description": "Handle at time of mention"
        }
      },
      "description": "ATProto-style mention (@handle)"
    },
    "nodeRefItem": {
      "type": "object",
      "required": [
        "type",
        "uri"
      ],
      "properties": {
        "uri": {
          "type": "string",
          "format": "at-uri",
          "description": "AT-URI of the referenced node"
        },
        "type": {
          "type": "string",
          "const": "nodeRef"
        },
        "label": {
          "type": "string",
          "maxLength": 500,
          "description": "Display label (cached from node)"
        },
        "subkind": {
          "type": "string",
          "maxLength": 50,
          "description": "Node subkind slug for styling (field, institution, person, etc.)"
        }
      },
      "description": "Knowledge graph node reference"
    },
    "facetRefItem": {
      "type": "object",
      "required": [
        "type",
        "uri"
      ],
      "properties": {
        "uri": {
          "type": "string",
          "format": "at-uri"
        },
        "type": {
          "type": "string",
          "const": "facetRef"
        },
        "label": {
          "type": "string",
          "maxLength": 500
        }
      },
      "description": "Facet classification node reference"
    },
    "fieldRefItem": {
      "type": "object",
      "required": [
        "type",
        "uri"
      ],
      "properties": {
        "uri": {
          "type": "string",
          "format": "at-uri"
        },
        "type": {
          "type": "string",
          "const": "fieldRef"
        },
        "label": {
          "type": "string",
          "maxLength": 500
        }
      },
      "description": "Academic field node reference"
    },
    "authorRefItem": {
      "type": "object",
      "required": [
        "type",
        "did"
      ],
      "properties": {
        "did": {
          "type": "string",
          "format": "did"
        },
        "type": {
          "type": "string",
          "const": "authorRef"
        },
        "label": {
          "type": "string",
          "maxLength": 200,
          "description": "Display name"
        }
      },
      "description": "Reference to an author by DID"
    },
    "codeBlockItem": {
      "type": "object",
      "required": [
        "type",
        "content"
      ],
      "properties": {
        "type": {
          "type": "string",
          "const": "codeBlock"
        },
        "content": {
          "type": "string",
          "maxLength": 50000
        },
        "language": {
          "type": "string",
          "maxLength": 50
        }
      },
      "description": "Code block"
    },
    "eprintRefItem": {
      "type": "object",
      "required": [
        "type",
        "uri"
      ],
      "properties": {
        "uri": {
          "type": "string",
          "format": "at-uri"
        },
        "type": {
          "type": "string",
          "const": "eprintRef"
        },
        "label": {
          "type": "string",
          "maxLength": 500,
          "description": "Eprint title for display"
        }
      },
      "description": "Reference to another eprint"
    },
    "blockquoteItem": {
      "type": "object",
      "required": [
        "type",
        "content"
      ],
      "properties": {
        "type": {
          "type": "string",
          "const": "blockquote"
        },
        "content": {
          "type": "string",
          "maxLength": 5000
        }
      },
      "description": "Blockquote"
    },
    "wikidataRefItem": {
      "type": "object",
      "required": [
        "type",
        "qid"
      ],
      "properties": {
        "qid": {
          "type": "string",
          "maxLength": 20,
          "description": "Wikidata QID (e.g., Q12345)"
        },
        "type": {
          "type": "string",
          "const": "wikidataRef"
        },
        "label": {
          "type": "string",
          "maxLength": 500,
          "description": "Display label"
        }
      },
      "description": "Wikidata entity reference"
    },
    "annotationRefItem": {
      "type": "object",
      "required": [
        "type",
        "uri"
      ],
      "properties": {
        "uri": {
          "type": "string",
          "format": "at-uri"
        },
        "type": {
          "type": "string",
          "const": "annotationRef"
        },
        "label": {
          "type": "string",
          "maxLength": 500,
          "description": "Text excerpt for preview"
        }
      },
      "description": "Reference to an annotation or review"
    }
  },
  "$type": "com.atproto.lexicon.schema",
  "lexicon": 1,
  "revision": 1,
  "description": "Shared definitions for unified rich text in Chive. All rich text content (abstracts, review bodies, annotation bodies, titles) references these types."
}
```
