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

# Input formats

> Import DOCX, ODT, RTF, Markdown, plain text, and HTML. Export DOCX, PDF, HTML, Markdown, and text.

The SDK accepts six input formats. All of them open in the same editor with
the same document model. They differ in how much of the source they preserve.

| Format | Extensions | Notes |
| - | - | - |
| DOCX | `.docx` | Full fidelity, and the only format whose untouched content exports back as the original bytes |
| ODT | `.odt` | LibreOffice, OpenOffice, and Google Docs exports: formatting, lists, tables, images, footnotes, headers and footers, comments, tracked changes |
| RTF | `.rtf` | Word, WordPad, TextEdit, and LibreOffice: formatting, lists, tables, images, footnotes, headers and footers, comments, tracked changes |
| Markdown | `.md`, `.markdown` | Headings, lists, tables, code, emphasis, links |
| Plain text | `.txt` | Paragraphs split on blank lines |
| HTML | `.html`, `.htm` | Headings, lists, tables, links, inline formatting |

```tsx theme={null}
<ReviseEditor
  initialDocuments={[
    { id: "contract", source: docxFile },
    { id: "report", source: odtFile },
    { id: "letter", source: rtfFile },
    { id: "notes", source: markdownFile },
    { id: "brief", source: htmlFile },
  ]}
/>
```

<Note>
  Earlier versions named this field `docx`. That name still works; pass one
  or the other.
</Note>

## Format detection

The SDK checks, in order:

1. An explicit `format` on the document input.
2. The filename extension, when the source is a `File`.
3. The MIME type, when the source is a `Blob` that carries one.
4. DOCX, as the fallback.

## Set the format

A `Blob` or `ArrayBuffer` built in memory has no filename, and its MIME type
may be missing or wrong. Pass `format`:

```tsx theme={null}
<ReviseEditor
  initialDocuments={[
    {
      id: "draft",
      source: new Blob([markdownString]),
      format: "markdown",
      title: "Draft",
    },
  ]}
/>
```

```ts theme={null}
await editor.documents.open({
  id: "imported",
  source: await response.blob(),
  format: "html",
});
```

<Warning>
  A source with no `format`, filename, or MIME type is parsed as DOCX. Any
  other content then fails to parse. Pass `format` when you build the source
  yourself.
</Warning>

The MIME types recognized for the binary formats are
`application/vnd.openxmlformats-officedocument.wordprocessingml.document`
(DOCX), `application/vnd.oasis.opendocument.text` (ODT), and
`application/rtf`, `text/rtf`, `application/x-rtf`, or `text/richtext` (RTF).

## Format details

<AccordionGroup>
  <Accordion title="DOCX">
    Preserves styles, fonts, tables, images, sections, page setup, headers
    and footers, footnotes and endnotes, comments, and tracked changes. All of
    them are written back on export.
  </Accordion>

  <Accordion title="ODT">
    Formatting is resolved through the document's styles and applied directly
    to the text: fonts, sizes, colors, highlighting, bold, italic, underline,
    strikethrough, superscript and subscript, small caps, and letter spacing;
    paragraph alignment, indents, spacing, line height, borders, shading, and
    page breaks. Lists keep their numbering, including start values and
    numbering that continues across interruptions. Tables keep merged cells,
    column widths, and cell shading. Images, footnotes and endnotes, running
    headers and footers, comments, tracked insertions and deletions, and page
    size and margins all come in.

    Floating pictures and text boxes are placed inline where they are
    anchored; charts and embedded objects come in as their preview image when
    the file carries one. Named styles are not kept as styles, only their
    effect.
  </Accordion>

  <Accordion title="RTF">
    Reads the RTF that Word ("Save as RTF"), WordPad, TextEdit, and
    LibreOffice write: fonts, sizes, colors, highlighting, and the full range
    of character formatting; paragraph alignment, indents, spacing, line
    spacing, borders, and shading; headings from Word's heading styles; lists
    from Word's list table and from WordPad's older bullet markup; tables with
    merged cells and column widths; PNG, JPEG, and Windows metafile pictures;
    hyperlinks; footnotes and endnotes; headers and footers; comments; tracked
    changes; and page size and margins. Text in any Windows code page or East
    Asian encoding decodes correctly.

    Tables nested inside table cells are flattened into the outer cell, and
    multi-column sections import as a single column.
  </Accordion>

  <Accordion title="Markdown">
    Headings, lists, and tables become the matching document blocks. Markdown
    has no page setup or revision marks, so the document opens with default
    page setup and no tracked changes.
  </Accordion>

  <Accordion title="Plain text">
    Each block of text separated by a blank line becomes a paragraph.
  </Accordion>

  <Accordion title="HTML">
    Structural markup maps to document blocks. Scripts, styles, and layout CSS
    are ignored.
  </Accordion>
</AccordionGroup>

## Titles

Without a `title`, the SDK uses the filename without its extension. `Master Agreement.docx` becomes "Master Agreement".

## Export

`tools.export()` produces a file in any of five formats:

```ts theme={null}
const docx = await editor.tools.export(); // .docx, tracked changes intact
const clean = await editor.tools.export({ format: "docx", mode: "final" });
const pdf = await editor.tools.export({ format: "pdf" });
const html = await editor.tools.export({ format: "html" });
const markdown = await editor.tools.export({ format: "markdown" });
```

| Format | Notes |
| - | - |
| `docx` (default) | Pending tracked changes and comments export as native Word revisions and comments. Untouched content from an imported .docx leaves as the original bytes. |
| `pdf` | Paginated like the editor, fonts embedded. Browser only. |
| `html` | A standalone page with styles. |
| `markdown` | Headings, lists, tables, links, code, and math. |
| `txt` | Plain text. |

Two modes decide what happens to pending changes:

* `"review"` (default): a .docx keeps pending tracked changes and comments;
  the other formats show the text with changes accepted.
* `"final"`: every pending change is accepted and every comment dropped
  first — a clean copy to send out. In the editor, a final .docx is
  regenerated rather than grafted onto the original file, so none of its
  revisions or comments come back. On the server, a final .docx keeps the
  original file's bytes for content the accepted changes didn't touch.

On the server, `exportDocument()` from `@reviseio/editor/server` takes the same options
for `docx`, `html`, `markdown`, and `txt`
([server API](/developer/docs/developer/docs/editor-sdk/api/backend)).

A document imported from ODT, RTF, Markdown, or HTML exports as a valid
`.docx`. ODT and RTF are import-only.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.