Version 0.1.0
Overview
Updated 9 hr ago
@m2d/tiptap: Tiptap extension to export rich-text editor content directly to Word (.docx) documents entirely on the client or server.
✨ Features
- 📄 Direct DOCX Export: Convert Tiptap rich-text content to Microsoft Word
.docxdocuments. - ⚡ Zero Cloud Dependencies: Client-side conversion using
@m2d/md2docxwithout paid subscriptions or external microservices. - 🛠️ Seamless Commands: Adds
editor.commands.downloadDocx()andeditor.commands.getDocxBlob()directly to the Tiptap editor instance. - 🎨 Full Document Styling: Configure metadata, headers, footers, margins, page orientation, and embedded plugins (Mermaid diagrams, LaTeX math, rich tables).
📦 Installation
$ pnpm add @m2d/tiptapor
$ npm install @m2d/tiptapor
$ yarn add @m2d/tiptap🚀 Usage
1. Register Extension
import { DocxExtension } from "@m2d/tiptap";
import { useEditor } from "@tiptap/react";
import StarterKit from "@tiptap/starter-kit";
const editor = useEditor({
extensions: [
StarterKit,
DocxExtension.configure({
defaultFilename: "my-document.docx",
}),
],
content: "<h1>Hello World</h1><p>Export me to DOCX!</p>",
});2. Export / Download DOCX
// Trigger instant browser download:
editor.commands.downloadDocx("custom-name.docx");
// Or obtain raw Blob for custom handling:
const blob = await editor.commands.getDocxBlob({
docxProps: {
title: "Quarterly Report",
creator: "Acme Corp",
},
});License
This library is licensed under the MIT open-source license.
with 💖 by Mayank Kumar Chaudhari