Exploring Markdown export capabilities

Welcome to this demonstration of our editor's ability to export content to Markdown,

ensuring that your content retains its intended appearance.

Text styles

This document showcases a variety of text styles:

  • Bold text is used to emphasize strong points.
  • Italic text adds subtle emphasis or indicates titles.
  • Underlined text highlights key information.
  • Strikethrough text shows corrections or deletions.

Alignment styling

Left Aligned: Text starts from the left margin.

Centered: Text is centered between the margins.

Right Aligned: Text ends at the right margin.

Table example

Tables are a great way to organize information:

Feature Description Example
Bold Emphasizes strong points Bold text
Italic Adds subtle emphasis Italic text

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 ...
  ],
})
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.

/**
 * 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
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 matrix.