Metadata-Version: 2.4
Name: convert-documents-skill
Version: 0.1.0
Summary: Convert .docx and .xlsx to Markdown with images extracted (optional .doc -> .docx via pywin32 on Windows)
Author: tianji
Author-email: tianji <shibutianji@163.com>
License: MIT
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: mammoth
Requires-Dist: pandas
Requires-Dist: openpyxl
Provides-Extra: windows
Requires-Dist: pywin32; platform_system == "Windows" and extra == "windows"
Dynamic: license-file

# convert-documents-skill (npm wrapper)

这是一个 Python 实现的文档转换工具（以 PyPI 为发布目标）。它将 .docx 转为 Markdown，并将 .xlsx 转为包含每个 Sheet 的 Markdown。输出会包含同名文件夹、.md 文件以及 <basename>_images/ 图片文件夹。

使用（推荐 Python 方式）

1. 在虚拟环境中安装依赖：

   python -m venv .venv
   .venv\Scripts\activate    # Windows
   pip install -r requirements.txt

2. 运行转换：

   python convert_documents_skill.py path/to/file.docx

说明：
- 支持 .docx（默认）和 .xlsx（Sheet -> Markdown）。
- 额外支持：.doc（需要 Windows + MS Word + pywin32）。脚本会尝试通过 COM 将 .doc 转为 .docx 后再处理；若未安装 pywin32 或 MS Word，会输出友好的报错信息。

输出：在源文件同级目录生成一个同名文件夹，里面包含 <basename>.md 和 <basename>_images/。

注意事项

- 若要转换 .doc（旧格式），请在 Windows 上安装 Microsoft Word 并 pip install pywin32。脚本会在转换失败时打印明确错误。
- 如果你的文档很复杂，mammoth 的转换结果可能需要人工校对。

Publishing

To publish to npm (wrapper package):

1. Update package.json repository, author, and version fields.
2. Run npm publish --access public (or with your scoped registry).

To publish to PyPI:

1. Ensure pyproject.toml and setup.cfg are updated with your metadata.
2. Build distributions: python -m build
3. Upload: python -m twine upload dist/*

Notes for OpenCode skill usage

- The npm package is a convenience wrapper that calls the Python script. For an OpenCode skill, package the Python code as a pip package and publish on PyPI, or publish the npm wrapper if the platform prefers npm.
- The script requires external binaries for .doc/.xls conversion on Windows (MS Office). For server-side usage, prefer .docx/.xlsx inputs.
