返回顶部
d

docx-md

|

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.1
安全检测
已通过
583
下载量
0
收藏
概述
安装方式
版本历史

docx-md

# Word DOCX (OOXML) – docx-md ## Overview Three entry points: **Read** – output compact Markdown (default, token-efficient) or full JSON; **Modify** – apply AI-returned edits to the docx; **Finalize** – accept all revisions and remove all comments. Implemented via OOXML (ZIP + XML). No commercial Word libraries required. ## Workflow | Goal | Action | |------|--------| | **Get document for AI** | **Read**: run read script → Markdown (default) or JSON. Markdown includes `<!-- b:N -->` blockIndex markers for edit targeting. | | **Apply AI edits to docx** | **Modify**: run apply script with docx + edits JSON → new docx with track changes and comments. | | **Deliver final version** | **Finalize**: run finalize script → new docx with no revisions/comments. | ## LLM-oriented pipeline 1. **Read** – Parse docx; output **Markdown** (default) or JSON. Markdown uses `<!-- b:N -->` prefix per block; revisions: `{+inserted+}` `{-deleted-}`; comments: `[comment: text]`. 2. Send the output + task prompt to the model; **require the model to output only the edit JSON**: `blockIndex`, `originalContent`, `content`, `basis` . 3. **Modify** – Script infers op from `blockIndex`, `originalContent`, `content`, `basis`; converts to OOXML (`w:ins` / `w:del` / comment anchors), then write back to Word. 4. **Finalize** – When the user confirms, run finalize to accept all revisions and remove all comments. See [references/llm-pipeline.md](references/llm-pipeline.md) for the Markdown format, JSON schema, and edit format. ## 1. Read - Parse `word/document.xml` (`w:body` only) and `word/comments.xml`. - Output **Markdown** (default) or **JSON**. Markdown is compact and token-efficient. **Script**: `scripts/read_docx.py` ```bash # Default: Markdown output (token-efficient) python3 skills/docx-md/scripts/read_docx.py document.docx python3 skills/docx-md/scripts/read_docx.py document.docx -o result.md # JSON output (full structure) python3 skills/docx-md/scripts/read_docx.py document.docx -f json -o result.json ``` **Options**: - `-o`, `--output` – Output path (default: stdout) - `-f`, `--format` – `md` (default) or `json` ## 2. Modify - **Input**: docx path + edit JSON `{ modifications: [{ blockIndex, originalContent, content, basis }] }` (same `blockIndex` as read output). - **Flow**: Convert JSON to OOXML (`w:ins` / `w:del` / comments), then write back to Word. **Script**: `scripts/apply_edits_docx.py`. Use `-` as edits file to read JSON from stdin. ```bash python3 skills/docx-md/scripts/apply_edits_docx.py document.docx edits.json -o output.docx python3 skills/docx-md/scripts/apply_edits_docx.py document.docx - -o output.docx # stdin ``` **Options**: `--author` (default: "Review") ## 3. Finalize - Accept all revisions (flatten to final text), remove all comments. Save as new docx. - Uses `docx-revisions` to accept revisions (preserves encoding), then removes comment markup via regex on raw bytes. **Script**: `scripts/finalize_docx.py` **Requires**: `pip install docx-revisions` (see `requirements.txt`) ```bash python3 skills/docx-md/scripts/finalize_docx.py input.docx -o output.docx ``` ## Resources ### scripts/ - **read_docx.py** – Read: `python3 scripts/read_docx.py document.docx [-o out.md] [-f md|json]` - **apply_edits_docx.py** – Modify: `python3 scripts/apply_edits_docx.py document.docx edits.json -o output.docx` - **finalize_docx.py** – Finalize: `python3 scripts/finalize_docx.py input.docx -o output.docx` ### references/ - **ooxml.md** – OOXML layout (document.xml, comments.xml, revisions, comments) - **llm-pipeline.md** – Pipeline: read → Markdown/JSON → model edits → modify; defines Markdown format, JSON shape (blockIndex, originalContent, content, basis)

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 docx-md-1776317189 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 docx-md-1776317189 技能

通过命令行安装

skillhub install docx-md-1776317189

下载 Zip 包

⬇ 下载 docx-md v1.0.1

文件大小: 18.83 KB | 发布时间: 2026-4-16 18:38

v1.0.1 最新 2026-4-16 18:38
- LICENSE.txt removed and replaced with LICENSE.
- Documentation updated to specify that the "finalize" script now uses the docx-revisions package to accept revisions (preserving encoding) and removes comments with a regex on raw bytes.
- Added requirement for the docx-revisions package in the finalize step, with install guidance in the documentation.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部