---
title: "Export Markdown from your editor"
description: "Learn how to export Tiptap editor content to Markdown files using the Export Markdown extension in our docs."
canonical_url: "https://tiptap.dev/docs/conversion/export/markdown/editor-extension"
---

# Export Markdown from your editor

Learn how to export Tiptap editor content to Markdown files using the Export Markdown extension in our docs.

- **1. Activate trial or subscribe**

  Start a [free trial](https://cloud.tiptap.dev/v2?trial=true) or [subscribe to the Start
  plan](https://cloud.tiptap.dev/v2/billing) in your account.
- **2. Install from private registry**

  To install this frontend extensions, authenticate to Tiptap's private npm registry by following
  the [setup guide](https://tiptap.dev/docs/guides/pro-extensions.md).

> **Interactive demo:** [ExportMarkdown](https://embed-pro.tiptap.dev/preview/Extensions/ExportMarkdown)

Use Tiptap's `@tiptap-pro/extension-export-markdown` to export your editor's content as a `.md` file. This extension converts your editor content to Markdown locally using the `@tiptap/markdown` extension; no API calls or credentials are required.

You can also use the [REST API](https://tiptap.dev/docs/conversion/export/markdown/rest-api.md) instead if you'd prefer to handle the conversion on your server.

## Install the Markdown Export extension

The Conversion extensions are published in Tiptap's private npm registry. Integrate the extensions by following the [private registry guide](https://tiptap.dev/docs/guides/pro-extensions.md).

Once done you can install and import the **Export Markdown** extension package.

```bash
npm i @tiptap-pro/extension-export-markdown
```

> **Required peer dependency:**
>
> This extension requires the `@tiptap/markdown` extension to be installed and configured in your
> editor. The `@tiptap/markdown` extension provides the serialization logic used to convert editor
> content to Markdown.

```bash
npm i @tiptap/markdown
```

```js
import { ExportMarkdown } from '@tiptap-pro/extension-export-markdown'
```

## Configuring the extension

The `ExportMarkdown` extension can be configured with an `ExportMarkdownOptions` (`object`) as an argument to the `configure` method with the following properties:

```ts
import { Markdown } from '@tiptap/markdown'
import { ExportMarkdown } from '@tiptap-pro/extension-export-markdown'

const editor = new Editor({
  extensions: [
    // Other extensions ...
    Markdown,
    ExportMarkdown.configure({
      onCompleteExport: (result) => {
        // Handle the exported Markdown string
      },
    }),
    // Other extensions ...
  ],
})
```

| Parameter          | Type                       | Description                                                      | Default                      |
| ------------------ | -------------------------- | ---------------------------------------------------------------- | ---------------------------- |
| `onCompleteExport` | `(result: string) => void` | Callback that receives the exported Markdown content as a string | Throws error if not provided |

## Export a Markdown file

With the extension installed, you can export your editor's content to `.md` using the `exportMarkdown` command.

```ts
/**
 * Export the current document as a Markdown string.
 *
 * Requires the @tiptap/markdown extension to be installed and
 * configured in the editor for serialization to work.
 *
 * @param options.onCompleteExport - Optional callback to override the extension-level handler
 * @example editor.commands.exportMarkdown({ onCompleteExport: (markdown) => console.log(markdown) })
 */
exportMarkdown: (options?: ExportMarkdownCommandOptions) => ReturnType
```

The `ExportMarkdownCommandOptions` interface:

| Property           | Type                       | Description                                                                            |
| ------------------ | -------------------------- | -------------------------------------------------------------------------------------- |
| `onCompleteExport` | `(result: string) => void` | Optional per-invocation callback that overrides the extension-level `onCompleteExport` |

```js
import { Markdown } from '@tiptap/markdown'
import { ExportMarkdown } from '@tiptap-pro/extension-export-markdown'

const editor = new Editor({
  extensions: [
    // Other extensions ...
    Markdown,
    ExportMarkdown.configure({
      onCompleteExport(result) {
        // Download the Markdown file
        const blob = new Blob([result], { type: 'text/markdown' })
        const url = URL.createObjectURL(blob)
        const a = document.createElement('a')

        a.href = url
        a.download = 'document.md'
        a.click()

        URL.revokeObjectURL(url)
      },
    }),
    // Other extensions ...
  ],
})

// Use the extension-level callback
editor.chain().exportMarkdown().run()

// Or override the callback for a specific export
editor
  .chain()
  .exportMarkdown({
    onCompleteExport(result) {
      // Custom handling, e.g. copy to clipboard
      navigator.clipboard.writeText(result)
    },
  })
  .run()
```

### How it works

When you call `exportMarkdown`, the extension uses the `@tiptap/markdown` extension's `getMarkdown()` method to serialize the editor's content locally. No data is sent to any external service. The `onCompleteExport` callback receives the Markdown string directly, which you can then download as a `.md` file, copy to clipboard, or process as needed.

## What to expect

- **No authentication required.** The export runs entirely in the browser. No JWT, no App ID, no API call.
- **Synchronous result delivery.** The `onCompleteExport` callback receives the Markdown string directly.
- **CommonMark output by default**, plus a few non-standard syntaxes for underline (`++text++`) and highlight (`==text==`).

## What not to expect

- **Lossless conversion.** Markdown has no syntax for font colors, font sizes, page layout, complex table cell formatting, or document metadata. Anything that doesn't map to CommonMark is dropped — see the table below.
- **Round-trip identity.** Re-importing the exported Markdown will produce a simplified document; styling and layout that didn't survive the export won't reappear.

## Support & Limitations

Markdown export converts Tiptap content to CommonMark-compatible Markdown. The supported features are determined by what Markdown syntax can represent. Unlike DOCX, Markdown has no concept of rich styling, page layout, or complex table formatting.

| **Feature**               | **Support**                                                             |
| ------------------------- | ----------------------------------------------------------------------- |
| **Text content**          | ✓ Paragraphs, headings (1–6), hard breaks                               |
| **Inline formatting**     | ✓ Bold, italic, strikethrough, inline code                              |
| **Block elements**        | ✓ Blockquotes, code blocks (fenced with language), horizontal rules     |
| **Lists**                 | ✓ Bullet lists, ordered lists, task lists, nested lists                 |
| **Tables**                | ✓ Basic pipe-syntax tables (single header row, no merged cells)         |
| **Links**                 | ✓ Hyperlinks with text and URL                                          |
| **Images**                | ✓ Image references with alt text (no dimensions)                        |
| **Underline**             | ✓ Custom syntax (`++text++`, non-standard)                              |
| **Highlight**             | ✓ Custom syntax (`==text==`, non-standard)                              |
| **Text color / Font**     | ✗ No Markdown syntax for colors, font family, or font size              |
| **Text alignment**        | ✗ No Markdown syntax                                                    |
| **Spacing / Indentation** | ✗ No Markdown syntax                                                    |
| **Merged cells**          | ✗ Markdown tables don't support colspan or rowspan                      |
| **Headers & Footers**     | ✗ No concept in Markdown                                                |
| **Page layout**           | ✗ No page breaks, sections, or page size                                |
| **Math**                  | \~ Extension-dependent (`$...$` syntax if math extension is configured) |
| **Footnotes & Endnotes**  | ✗ Not supported in CommonMark                                           |

For the full feature comparison across all formats, see the [Supported features](https://tiptap.dev/docs/conversion/getting-started/feature-support-matrix.md) matrix.
