# Documents you can edit, read and export.

> Edit, read, paginate and export block documents.

Language: en
Canonical: https://texuli.com/solutions/documents/
Markdown: https://texuli.com/solutions/documents.md (this page). Every texuli.com page has a Markdown twin at its URL plus `.md` (the home page is https://texuli.com/index.md), and any page URL answers `Accept: text/markdown` with its twin instead of HTML.
Last Updated: 2026-11-13

---

Solution · Documents

One block model behind the editor, the reader and every export. Each edit can be undone, and Markdown, DOCX and PDF come from the same source.

Status: in development

[Edit the live report](https://texuli.com/solutions/documents/#demo)[Get started](https://texuli.com/solutions/documents/#quickstart)

 ![Isometric stacked document pages and a lilac-glass table of contents assembling from cubes](https://texuli.com/_astro/solution-documents-hero.DVLDe_TW.webp)

## Edit a real report

Try this

- Start the demo, then rename the report title or add a block.
- Undo and redo your edits, or switch between editing and reading.
- Use Reset example to return to the starting report.

Use Reset to return to the starting example.

## Lumen quarterly product report

Lumen is a fictional note-taking app. This report sums up the quarter for the team.

### Highlights

- Offline mode shipped to every workspace.
- Search results now load in one round trip.
- Every dialog passed a keyboard-only review.

### Metrics

The numbers below are sample data, not real usage.

The metrics block renders in the interactive demo.

The report preview is ready; editing tools load when you start.

If the interactive demo cannot load, use the static preview above.

## One document. Every way to work with it.

### Edit without fear: every change can be undone

Each change is a typed operation with an exact inverse, kept in one op log, so undo and redo always work. The editor adds a slash menu of every block type and block drag with keyboard equivalents.

- Edit

 ![A document page with a slash-menu card of block cubes and a rewind pair of chevron tiles](https://texuli.com/_astro/solution-documents-story-1.CSDVj3Cp.webp)

### From the editor to the reader to the printed page

A read-only reader gives headings anchors and an outline. The paged view lays the same document out on real pages with headers and footers, and prints one sheet per page. Editing in the paged view is planned.

- Read
- Paged-view editing (planned)

 ![A read-only document with a lilac outline rail beside two physical pages that have header and footer bars](https://texuli.com/_astro/solution-documents-story-2.CsFL61Iu.webp)

### One source, three formats

Import and export Markdown, and write DOCX and PDF with writers Texuli owns. Every format comes from the same block document, so nothing is converted by hand.

- Export

 ![One block document splitting into three export tiles: a skeleton sheet, a folded page and a stacked print page](https://texuli.com/_astro/solution-documents-story-3.BHFaIsx-.webp)

## From blocks to a finished document.

- ### Author Compose typed blocks with persisted ids, or load a document from an agent or a file through the untrusted loader.Package: `@texuli/document`
- ### Edit with operations Every change is a typed operation with an exact inverse in one op log, so undo and redo share one history.Package: `@texuli/document`
- ### Write rich text A formatting toolbar, a link dialog, safe paste, and Markdown in and out.Package: `@texuli/editor`
- ### Edit and read The page editor adds a slash menu and block drag with keyboard equivalents; the reader shows the result read-only, with an outline.Package: `@texuli/pages`
- ### Export Markdown, DOCX and PDF from writers Texuli owns; the pages export entry hands the file to the browser.Package: `@texuli/document`
- ### Sync, if you need it The CRDT sync core merges edits from several replicas; the collaborative editor adds comments, suggestions and version history. Your app supplies the transport.Package: `@texuli/document`

Documents is built from @texuli/pages, @texuli/editor and @texuli/document, on @texuli/player, @texuli/blocks, texuli, @texuli/tokens, @texuli/primitives, @texuli/core, @texuli/deck and @texuli/drag.

Solution

Documents

Packages

- L8[`@texuli/pages`](https://www.npmjs.com/package/@texuli/pages) Editor, reader, exports and collaboration surfaces Subpaths: ./editor · ./reader · ./export · ./collab
- L4[`@texuli/editor`](https://www.npmjs.com/package/@texuli/editor) Rich text surface inside the document editor Subpaths: ./editor · ./markdown
- L1[`@texuli/document`](https://www.npmjs.com/package/@texuli/document) Document model, operations, Markdown, pagination, DOCX and PDF writers, sync Subpaths: ./model · ./ops · ./markdown · ./paged · ./docx · ./pdf · ./sync

Built on

- L7 `@texuli/player` (Blueprint player)
- L5 `@texuli/blocks` (Content blocks)
- L3 `texuli` (Styled components)
- L2 `@texuli/tokens` (Theme tokens)
- L1 `@texuli/primitives` (Headless primitives)
- L0 `@texuli/core` (Texels and the URL policy)
- L0 `@texuli/deck` (Deck model and engine)
- L0 `@texuli/drag` (Drag engine)

 ![Six-beat isometric pipeline from block cubes through an op log, an editor, a reader, export tiles and two merging replicas](https://texuli.com/_astro/solution-documents-how.CNYGM-cI.webp)

Build with Documents

## Start with a document

### Install

```
pnpm add @texuli/document @texuli/pages @texuli/editor @texuli/tokens
```

### Create and edit

```
import { createDocument, paragraphBlock } from '@texuli/document/model';
import { applyOperations } from '@texuli/document/ops';
import { documentToMarkdown } from '@texuli/document/markdown';

const doc = createDocument({
  meta: { title: 'Release notes' },
  blocks: [paragraphBlock('p1', 'Shipped the new editor.')],
});

const edit = applyOperations(doc, [
  { op: 'insert-text', id: 'p1', offset: 0, text: 'Today: ' },
]);

if (edit.ok) {
  console.log(documentToMarkdown(edit.document));
}
```

### Load untrusted JSON

```
import { loadUntrustedDocument } from '@texuli/document/schema';

const result = loadUntrustedDocument({
  "format": "texuli-document",
  "formatVersion": 1,
  "meta": {
    "title": "Release notes",
    "locale": "en"
  },
  "blocks": [
    {
      "id": "p1",
      "type": "paragraph",
      "content": [
        {
          "type": "text",
          "text": "Shipped the new editor.",
          "marks": []
        }
      ]
    }
  ]
});

if (result.ok) {
  console.log(result.document.blocks.length);
}
```

### Edit with PageEditor

```
<script lang="ts">
  import { createDocument, paragraphBlock } from '@texuli/document/model';
  import { PageEditor } from '@texuli/pages/editor';
  import '@texuli/tokens/base.css';

  let doc = $state.raw(
    createDocument({
      meta: { title: 'Release notes' },
      blocks: [paragraphBlock('p1', 'Shipped the new editor.')],
    }),
  );
</script>

<PageEditor document={doc} onChange={(next) => (doc = next)} />
```

Verified by `apps/website/tests/solutions/documents-quickstart.test.ts`

## Recipes

- ### [Edit and read a document](https://texuli.com/guides/solutions/documents/) Mount the editor and the reader on one document, step by step in the Documents docs.
- ### [Model, Markdown, DOCX and PDF without a UI (external site)](https://www.npmjs.com/package/@texuli/document) Use @texuli/document on its own: operations with undo, Markdown in and out, and the owned DOCX and PDF writers.
- ### [Install the editor and reader (external site)](https://www.npmjs.com/package/@texuli/pages) Add @texuli/pages from npm (pre-1.0, in development).

## For agents

Agents write a document as data, edit it with bounded patches, and convert it to and from Markdown. The packages are in development.

- [MCP server](https://texuli.com/mcp-server/)
- [Agent skill](https://texuli.com/skill/)
- [Building with agents](https://texuli.com/agents-page/)

- `document.run` document.run: In developmentMCP operation: validate, inspect, patch and convert a document, from Markdown and to Markdown.
- `document.export` document.export: In developmentMCP operation on the local server: write a document as PDF or DOCX bytes.
- `document` document: In developmentCatalog component that carries a whole document inside a blueprint.
- `skills/texuli/blueprints/references/documents.md` skills/texuli/blueprints/references/documents.md: In developmentSkill reference for documents as data and their patches.

## Platforms

- ### Web Web: In developmentSvelte 5 packages published on npm (pre-1.0).
- ### Compose Desktop Compose Desktop: PlannedKotlin Multiplatform renderer on the JVM, built in this repository.
- ### Android Android: PlannedNative renderer target.
- ### iOS iOS: PlannedNative renderer target.

[How the native renderer works](https://texuli.com/native/)

## More Solutions

- ### [Slides](https://texuli.com/solutions/slides/) Write decks as JSON or Markdown and present them in the browser.Status: in development
- ### [Workflows](https://texuli.com/solutions/workflows/) Author and view workflow graphs inside your app.Status: in development
- ### [Canvas](https://texuli.com/solutions/canvas/) An embeddable whiteboard with shapes, connectors and export.Status: in development
- ### [Sheets](https://texuli.com/solutions/sheets/) An embeddable spreadsheet with formulas and CSV.Status: in development
- ### [Design systems](https://texuli.com/solutions/design-systems/) Carry one brand document across Texuli surfaces.Status: available
- ### [Dashboards](https://texuli.com/solutions/dashboards/) KPI boards people arrange, from the keyboard too.Status: in development
- ### [Forms](https://texuli.com/solutions/forms/) Schema-driven forms with conditions, steps and drafts.Status: in development
- ### [Agent chat](https://texuli.com/solutions/agent-chat/) A thread whose replies paint validated blueprints.Status: in development
- ### [Rich text editor](https://texuli.com/solutions/editor/) Owned rich text with Markdown in and out, safe paste and export to any chat.Status: in development

## Start building with Documents

Edit, read, paginate and export block documents.

[Read the Documents guide](https://texuli.com/guides/solutions/documents/)[Edit the live report](https://texuli.com/solutions/documents/#demo)[@texuli/pages on npm](https://www.npmjs.com/package/@texuli/pages)

 ![A low horizon of stacked cubes rising to one glowing pearl cube under a wide open sky](https://texuli.com/_astro/home-final.BGuYKnjC.webp) ![A low horizon of stacked cubes rising to one glowing pearl cube under a wide open sky](https://texuli.com/_astro/home-final.BGuYKnjC.webp)

## For agents

Edit a report: the live Documents demo runs in the browser on fixture data. Runs in the browser on one fixture document; nothing is saved. The live parts run in the browser and are not in this Markdown; the operations below do the same work through the read-only MCP server at https://texuli.com/mcp (no sign-in; see https://texuli.com/auth.md).

Limits today:

- Pre-1.0 and in development: a new minor version may break the API.
- Paged-view editing is planned; the paged view is read-only today.
- Sheet and canvas embeds are references, not painted embeds.
- Collaboration needs a transport from the host app; there is no hosted service.

MCP operations ([reference](https://github.com/DailybotHQ/texuli/blob/main/packages/tools/docs/ops.md#operations)):

- `document.run`: Run a document command.
- `block.list`: List block types.
- `block.schema`: Read a block shape.

Docs:

- [Documents docs](https://texuli.com/guides/solutions/documents/)
- [@texuli/document README](https://github.com/DailybotHQ/texuli/blob/main/packages/document/README.md)
- [@texuli/pages README](https://github.com/DailybotHQ/texuli/blob/main/packages/pages/README.md)
- [@texuli/editor README](https://github.com/DailybotHQ/texuli/blob/main/packages/editor/README.md)
