# social.coves.richtext.facet

> Published by [coves.social](https://lexicon.garden/identity/did:web:coves.social)

✓ This is the authoritative definition for this NSID.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:web:coves.social/social.coves.richtext.facet)
- [Documentation](https://lexicon.garden/lexicon/did:web:coves.social/social.coves.richtext.facet/docs)
- [Examples](https://lexicon.garden/lexicon/did:web:coves.social/social.coves.richtext.facet/examples)

## Definitions

### `social.coves.richtext.facet#bold`

**Type**: `object`

Bold text formatting

### `social.coves.richtext.facet#code`

**Type**: `object`

Inline code span rendered in monospace. Writers strip the source markup markers (e.g. backticks); the annotated text is the literal code.

### `social.coves.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 | Target URI of the link |

### `social.coves.richtext.facet`

**Type**: `object`

Annotation of a sub-string within rich text

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `index` | `ref` → `#byteSlice` | Yes |  |
| `features` | `array` | Yes | Features applied to this text range. This union is open: readers MUST render the annotated text as plain text when they do not recognize a feature's $type. Ranges of different block types may nest by containment (e.g. a codeBlock inside a blockquote); only blockquote-in-blockquote containment is disallowed (nested quotes use disjoint ranges with increasing level). |

### `social.coves.richtext.facet#italic`

**Type**: `object`

Italic text formatting

### `social.coves.richtext.facet#heading`

**Type**: `object`

Section heading. The range must span a single whole line (excluding the trailing newline); readers encountering a range that does not should extend it to the enclosing line boundaries. Writers strip the source markup markers (e.g. Markdown '#'); the text is canonical and must remain readable without this facet.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `level` | `integer` | Yes | Heading level, 1 (largest) through 6 |

### `social.coves.richtext.facet#mention`

**Type**: `object`

Facet feature for mention of a user or community. The text is usually a handle with '@' (user) or '!' (community) prefix, but the facet reference is a DID.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `did` | `string` (did) | Yes | DID of the mentioned user or community |

### `social.coves.richtext.facet#spoiler`

**Type**: `object`

Hidden/spoiler text that requires user interaction to reveal

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `reason` | `string` | No | Optional explanation of what's hidden |

### `social.coves.richtext.facet#byteSlice`

**Type**: `object`

Specifies the sub-string range via byte indices

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `byteEnd` | `integer` | Yes | Exclusive end position in UTF-8 bytes |
| `byteStart` | `integer` | Yes | Inclusive start position in UTF-8 bytes |

### `social.coves.richtext.facet#codeBlock`

**Type**: `object`

Block of preformatted code rendered in monospace with whitespace preserved. The range must span whole lines (excluding the trailing newline); readers encountering a range that does not should extend it to the enclosing line boundaries. Writers strip the source fence markers (e.g. Markdown ```); the annotated text is the literal code.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `language` | `string` | No | Optional language hint for syntax highlighting (e.g. 'go', 'python') |

### `social.coves.richtext.facet#blockquote`

**Type**: `object`

Block-level quotation. The range must span whole lines: from the first byte of the first quoted line through the last content byte of the last quoted line, excluding the trailing newline. Readers encountering a range that does not span whole lines should extend the block to the enclosing line boundaries. Consecutive quoted lines at the same depth should be covered by a single facet; readers should render adjacent same-level quote facets as separate blocks. Nested quotes are expressed as disjoint ranges with increasing level values, not by nesting ranges. Writers must clamp source nesting deeper than 6 to level 6, and strip the source markup markers (e.g. Markdown '>'); the text is canonical and must remain readable without this facet.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `level` | `integer` | No | Quote nesting depth. Absent means 1. |

### `social.coves.richtext.facet#strikethrough`

**Type**: `object`

Strikethrough text formatting

## Raw Schema

```json
{
  "id": "social.coves.richtext.facet",
  "defs": {
    "bold": {
      "type": "object",
      "description": "Bold text formatting"
    },
    "code": {
      "type": "object",
      "description": "Inline code span rendered in monospace. Writers strip the source markup markers (e.g. backticks); the annotated text is the literal code."
    },
    "link": {
      "type": "object",
      "required": [
        "uri"
      ],
      "properties": {
        "uri": {
          "type": "string",
          "format": "uri",
          "description": "Target URI of the link"
        }
      },
      "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",
              "#bold",
              "#italic",
              "#strikethrough",
              "#spoiler",
              "#blockquote",
              "#heading",
              "#code",
              "#codeBlock"
            ],
            "type": "union"
          },
          "maxLength": 20,
          "description": "Features applied to this text range. This union is open: readers MUST render the annotated text as plain text when they do not recognize a feature's $type. Ranges of different block types may nest by containment (e.g. a codeBlock inside a blockquote); only blockquote-in-blockquote containment is disallowed (nested quotes use disjoint ranges with increasing level)."
        }
      },
      "description": "Annotation of a sub-string within rich text"
    },
    "italic": {
      "type": "object",
      "description": "Italic text formatting"
    },
    "heading": {
      "type": "object",
      "required": [
        "level"
      ],
      "properties": {
        "level": {
          "type": "integer",
          "maximum": 6,
          "minimum": 1,
          "description": "Heading level, 1 (largest) through 6"
        }
      },
      "description": "Section heading. The range must span a single whole line (excluding the trailing newline); readers encountering a range that does not should extend it to the enclosing line boundaries. Writers strip the source markup markers (e.g. Markdown '#'); the text is canonical and must remain readable without this facet."
    },
    "mention": {
      "type": "object",
      "required": [
        "did"
      ],
      "properties": {
        "did": {
          "type": "string",
          "format": "did",
          "description": "DID of the mentioned user or community"
        }
      },
      "description": "Facet feature for mention of a user or community. The text is usually a handle with '@' (user) or '!' (community) prefix, but the facet reference is a DID."
    },
    "spoiler": {
      "type": "object",
      "properties": {
        "reason": {
          "type": "string",
          "maxLength": 128,
          "description": "Optional explanation of what's hidden",
          "maxGraphemes": 32
        }
      },
      "description": "Hidden/spoiler text that requires user interaction to reveal"
    },
    "byteSlice": {
      "type": "object",
      "required": [
        "byteStart",
        "byteEnd"
      ],
      "properties": {
        "byteEnd": {
          "type": "integer",
          "minimum": 0,
          "description": "Exclusive end position in UTF-8 bytes"
        },
        "byteStart": {
          "type": "integer",
          "minimum": 0,
          "description": "Inclusive start position in UTF-8 bytes"
        }
      },
      "description": "Specifies the sub-string range via byte indices"
    },
    "codeBlock": {
      "type": "object",
      "properties": {
        "language": {
          "type": "string",
          "maxLength": 40,
          "description": "Optional language hint for syntax highlighting (e.g. 'go', 'python')"
        }
      },
      "description": "Block of preformatted code rendered in monospace with whitespace preserved. The range must span whole lines (excluding the trailing newline); readers encountering a range that does not should extend it to the enclosing line boundaries. Writers strip the source fence markers (e.g. Markdown ```); the annotated text is the literal code."
    },
    "blockquote": {
      "type": "object",
      "properties": {
        "level": {
          "type": "integer",
          "maximum": 6,
          "minimum": 1,
          "description": "Quote nesting depth. Absent means 1."
        }
      },
      "description": "Block-level quotation. The range must span whole lines: from the first byte of the first quoted line through the last content byte of the last quoted line, excluding the trailing newline. Readers encountering a range that does not span whole lines should extend the block to the enclosing line boundaries. Consecutive quoted lines at the same depth should be covered by a single facet; readers should render adjacent same-level quote facets as separate blocks. Nested quotes are expressed as disjoint ranges with increasing level values, not by nesting ranges. Writers must clamp source nesting deeper than 6 to level 6, and strip the source markup markers (e.g. Markdown '>'); the text is canonical and must remain readable without this facet."
    },
    "strikethrough": {
      "type": "object",
      "description": "Strikethrough text formatting"
    }
  },
  "$type": "com.atproto.lexicon.schema",
  "lexicon": 1
}
```
