Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.superdoc.dev/llms.txt

Use this file to discover all available pages before exploring further.

SuperDoc treats DOCX as the real document, not an export target. Load a Word file, edit it in the browser, and export a Word file again. Tracked changes, comments, and complex tables all stay intact. HTML and Markdown are useful for AI-generated content; DOCX is the full-fidelity path. For the full reference, see Editor > SuperDoc > Import/Export.

Loading a document

Pass anything that looks like a document to the document option:
new SuperDoc({
  selector: '#editor',
  document: docxFile, // File, Blob, URL string, or config object
});
For HTML, Markdown, or JSON content, pair the alternate input with a base DOCX (used for styles):
new SuperDoc({
  selector: '#editor',
  document: blankDocx,
  html: '<h1>Title</h1><p>Content</p>',
  // markdown: '# Title\n\nContent'
  // jsonOverride: documentSchema
});

Exporting

Default superdoc.export() triggers a browser download. To upload to your backend instead, ask for the raw Blob:
// Download
await superdoc.export();

// Upload: get the Blob, send it yourself
const blob = await superdoc.export({ triggerDownload: false });
await fetch('/api/save', { method: 'POST', body: blob });
For HTML, JSON, or Markdown output, read directly from the active editor:
const html = superdoc.activeEditor.getHTML();
const json = superdoc.activeEditor.getJSON();
const markdown = await superdoc.activeEditor.getMarkdown();

Format tradeoffs

FormatRound-trip fidelityUse it for
DOCXFullReal Word documents: open in Word with nothing lost
JSONFullProgrammatic control, AI/agent input/output
HTMLStructure only (no CSS)Web content, AI-generated HTML
MarkdownStructure onlyDocumentation, simple AI input
DOCX preserves tracked changes, comments, complex tables, and section breaks. HTML and Markdown are structure-first: they don’t preserve Word-specific formatting.

What should I store in my backend?

Store the DOCX blob if you want full fidelity (recommended). Store JSON if you want programmatic search/diff and don’t need round-tripping with Word users. Don’t store HTML or Markdown unless you accept losing fidelity.

Common pitfalls

  • Duplicate downloads. superdoc.export() triggers a browser download by default. If you want to upload to a backend, pass { triggerDownload: false }: otherwise you get the file twice.
  • HTML import without a base DOCX. The html and markdown options need a document (a base .docx) for styles. Without one, headings and lists fall back to defaults.
  • HTML round-trips lose styling. Importing HTML, exporting DOCX, and then importing the resulting HTML back will not produce the original Word styling. For round-tripping, use DOCX or JSON.

Where to next