# rtext

> Rich Text library

Latest version **0.1.0** (published 2017-07-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install rtext
pnpm add rtext
yarn add rtext
bun add rtext
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2017-07-28 |
| First published | 2017-07-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Boris Kaul |
| Maintainers | localvoid |
| Keywords | rich, text |

## Links

- npm: https://www.npmjs.com/package/rtext
- Repository: https://github.com/localvoid/rtext
- Issues: https://github.com/localvoid/rtext/issues
- npm.io page: https://npm.io/package/rtext

## Alternatives

- [ext-list](https://npm.io/package/ext-list.md) — 6.3M weekly downloads
- [@lexical/selection](https://npm.io/package/@lexical/selection.md) — 3.8M weekly downloads
- [@lexical/text](https://npm.io/package/@lexical/text.md) — 3.6M weekly downloads
- [@lexical/clipboard](https://npm.io/package/@lexical/clipboard.md) — 3.0M weekly downloads
- [@tiptap/extension-mention](https://npm.io/package/@tiptap/extension-mention.md) — 3.0M weekly downloads

## Recent versions

- 0.1.0 (latest) — 2017-07-28

## README

# Rich Text Core Data Structures

This package provides type definitions for `rtext` core data structures.

Rich text is stored as a simple string with an additional array of annotations.

```ts
interface RichText {
  readonly text: string;
  readonly annotations?: RichTextAnnotation[];
}
```

Annotations has a `type`, `start` and `end` positions that specify annotated range. Optional `data` property can
provide an additional data, and optional `key` property helps with overlapping annotations.

```ts
interface RichTextAnnotation<T = any> {
  readonly type: string;
  readonly start: number;
  readonly end: number;
  readonly data?: T;
  readonly key?: string;
}
```

All annotations stored in `RichText` should be sorted by their `start` positions. `rtext-writer` package
automatically guarantee that rich text composed by this package will be in correct format.

And that is all, you are free to choose which types to use and what data to store. With `rtext-render` package it will
be easy to convert rich texts into any format you like, for example, colored output in terminal, or HTML in browser.

---
_Source: https://npm.io/package/rtext · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
