> ## Documentation Index
> Fetch the complete documentation index at: https://docs.reelevant.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Truncate

> Truncate text to a specific length

## Overview

The `truncate` transformation truncates the input to a specific size, with optional start position and ellipsis.

## Syntax

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
truncate(<variable>, start=0, end=10, ellipsis=false, smart=false)
```

## Parameters

| Parameter  | Type    | Required | Default | Description                                                    |
| ---------- | ------- | -------- | ------- | -------------------------------------------------------------- |
| `variable` | string  | Yes      | -       | The text to truncate                                           |
| `start`    | number  | Yes      | -       | Start position for truncation                                  |
| `end`      | number  | No       | -       | Maximum character length                                       |
| `ellipsis` | boolean | Yes      | -       | Whether to add ellipsis (...) at the end                       |
| `smart`    | boolean | No       | -       | When true, truncates at the last space before the end position |

## Examples

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
truncate(<variable>, start=0, end=10, ellipsis=false)
truncate(<variable>, 0, 20, true)
truncate(<variable>, start=0, end=50, ellipsis=true, smart=true)
```
