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

# Input formats

> DOCX, Markdown, plain text, and HTML in — DOCX out.

The SDK accepts four input formats. Whichever you hand it, you get the same
editor and the same document model; the difference is how much of the original
survives the trip in.

| Format     | Extensions         | Notes                                                                                                |
| ---------- | ------------------ | ---------------------------------------------------------------------------------------------------- |
| DOCX       | `.docx`            | Full fidelity — the only format carrying comments, tracked changes, sections, headers, and footnotes |
| 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", docx: docxFile },
    { id: "notes", docx: markdownFile },
    { id: "brief", docx: htmlFile },
  ]}
/>
```

<Note>
  The field is called `docx` for backwards compatibility with hosts that
  predate the text formats. It accepts any supported source.
</Note>

## How the format is detected

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.

## Declaring the format explicitly

A `Blob` or `ArrayBuffer` assembled in memory has no filename, and its MIME
type may be missing or wrong. Say what it is:

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

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

<Warning>
  Without a filename or MIME type, an undeclared source is treated as DOCX and
  will fail to parse if it is really text. Pass `format` whenever you build the
  source yourself.
</Warning>

## What each format brings

<AccordionGroup>
  <Accordion title="DOCX">
    The high-fidelity path. Styles, fonts, tables, images, sections, page
    setup, running headers and footers, footnotes and endnotes, comments, and
    tracked changes all survive, and all of them come back out on export.
  </Accordion>

  <Accordion title="Markdown">
    Parsed into real blocks — headings become headings, tables become tables.
    Since Markdown has no concept of pagination or revision marks, the document
    opens with default page setup and no tracked changes.
  </Accordion>

  <Accordion title="Plain text">
    Blank-line-separated paragraphs. Useful for pasted content and transcripts.
  </Accordion>

  <Accordion title="HTML">
    Structural markup is mapped to document blocks. Scripts, styles, and layout
    CSS are ignored: this is a document importer, not a browser.
  </Accordion>
</AccordionGroup>

## Titles

When you do not pass a `title`, the SDK derives one from the filename, minus
the extension. `Master Agreement.docx` becomes "Master Agreement".

## Export

Export is DOCX:

```ts theme={null}
const blob = await editor.tools.exportDocx();
```

A document imported from Markdown or HTML exports as a well-formed `.docx`, so
the SDK doubles as a conversion step in a pipeline that ends in Word.
