⚠️ Warning: This project is not yet stable and may undergo significant changes before reaching version 1.0.0. We strongly advise against using it in production environments.
Universal document format converter and DOCX editor built on TipTap/ProseMirror, with comprehensive TypeScript support. Convert between Markdown, HTML, and DOCX through a unified Tiptap JSON model.
| Package | Version | Description |
|---|---|---|
| docen | All-in-one — headless Markdown/HTML/DOCX conversion + the full <docen-document> editor |
|
| @docen/vue | Vue 3 adapter — <DocenDocument> component (v-model + v-slot editor) |
|
| @docen/editor | Assembly layer — Fluent UI host + docx engine into <docen-document> |
|
| @docen/docx | Tiptap DOCX editor + converters, powered by @office-open/docx |
For seamless conversion between Markdown, HTML, and DOCX through a single unified API:
# Install with pnpm
$ pnpm add docenimport { parseHTML, generateDOCX, parseMarkdown, generateHTML } from "docen";
// HTML → DOCX
const doc = parseHTML("<h1>Title</h1><p>Hello World</p>");
const docx = await generateDOCX(doc);
// Markdown → HTML
const doc2 = parseMarkdown("# Title\n\nHello World");
const html = generateHTML(doc2);💡 The
docenpackage also bundles the full engine and editor —import { createDocxEditor } from "docen/docx"orimport { DocenDocument } from "docen/editor"— so one dependency covers headless conversion, the engine, and the web component.
A full-featured WYSIWYG DOCX editor with near-lossless round-trip conversion:
$ pnpm add @docen/docximport { createDocxEditor, parseDOCX, generateDOCX } from "@docen/docx";
const editor = createDocxEditor({ element: document.querySelector("#editor") });
editor.commands.setContent(parseDOCX(buffer));
const output = await generateDOCX(editor.getJSON());A turnkey web-component editor (<docen-document>) bundling the Fluent UI host with the @docen/docx engine:
$ pnpm add @docen/editor<docen-document id="doc" filename="Welcome.docx"></docen-document>
<script type="module">
import { registerComponents, applyTheme } from "@docen/editor";
registerComponents();
applyTheme("light");
</script>A typed <DocenDocument> component — v-model for content, a v-slot="{ editor }" scope, and a template-ref expose — for Vue 3:
$ pnpm add @docen/vue<script setup lang="ts">
import { ref } from "vue";
import { DocenDocument } from "@docen/vue";
import { parseDOCX } from "@docen/docx";
// v-model keeps content in sync; the template ref exposes the Tiptap editor.
const content = ref("<p>Hello</p>");
const editorRef = ref();
async function open(file: File) {
const json = await parseDOCX(await file.arrayBuffer());
editorRef.value?.editor?.commands.setContent(json);
}
</script>
<template>
<DocenDocument ref="editorRef" v-model="content" filename="Welcome.docx" editable />
</template>- Node.js 18.x or higher
- pnpm 9.x or higher (recommended package manager)
- Git for version control
-
Clone the repository:
git clone https://github.com/DemoMacro/docen.git cd docen -
Install dependencies:
pnpm install
-
Build all packages:
pnpm build
pnpm build # Build all packages
cd packages/<pkg> && pnpm build # Build one package
vp check # Lint & formatWe welcome contributions! See CONTRIBUTING.md for the full contribution workflow, coding standards, and PR checklist.
- 📫 Report Issues
- 📚 docen Documentation
- 📚 @docen/vue Documentation
- 📚 @docen/editor Documentation
- 📚 @docen/docx Documentation
This project is licensed under the MIT License - see the LICENSE file for details.
Built with ❤️ by Demo Macro
