Export Markdown from your editor

Available in Start planBetav0.2.0

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 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.

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

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.

npm i @tiptap/markdown
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:

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 ...
  ],
})
ParameterTypeDescriptionDefault
onCompleteExport(result: string) => voidCallback that receives the exported Markdown content as a stringThrows 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.

/**
 * 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:

PropertyTypeDescription
onCompleteExport(result: string) => voidOptional per-invocation callback that overrides the extension-level onCompleteExport
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.

FeatureSupport
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 matrix.