M AI 员工技能商店
AI 员工平台 返回商城
返回技能商店

Moss 文件格式转换插件

v1.0.0 · 文档处理 · 官方

转换 Markdown HTML Word PDF Moss

简介

Moss 文件格式转换插件 v1.0,AI 一键转换本地文档:

  • md_to_html Markdown → 带样式 HTML
  • html_to_md HTML → Markdown
  • md_to_txt / html_to_txt 提取纯文本
  • txt_to_docx 文本 → Word 文档
  • docx_to_pdf Word → PDF(LibreOffice 或 Word)
  • 支持 input 文件content 字符串 两种输入

适用:README 转网页、网页转 MD、纪要转 Word、报告转 PDF。

操作说明

action转换依赖
md_to_htmlMD→HTMLmarkdown
html_to_mdHTML→MDhtml2text
md_to_txtMD→TXT
html_to_txtHTML→TXT
txt_to_docxTXT→docxpython-docx
docx_to_pdfdocx→PDFLibreOffice/docx2pdf
formats查支持列表

安装

  1. 解压到 D:\moss-plugins\文档处理\文件格式转换插件\
  2. 复制 python/ 到本目录
  3. 安装依赖:
python\python.exe -m pip install markdown html2text python-docx
  1. Word→PDF 额外装 LibreOffice(推荐)或 pip install docx2pdf(需 MS Word)
  2. 测试:run.bat --action formats
文件说明
file_convert_plugin.py主程序
run.bat / run.sh启动脚本
文件格式转换插件.md用户文档

命令行

run.bat --action md_to_html --input D:\docs\readme.md --output D:\docs\readme.html
run.bat --action html_to_md --input D:\docs\page.html
run.bat --action txt_to_docx --input D:\docs\notes.txt --title 会议纪要
run.bat --action docx_to_pdf --input D:\docs\报告.docx --output D:\docs\报告.pdf
run.bat --action md_to_html --content "# 标题\n正文" --output D:\docs\out.html

注册技能 file_convert

名称: file_convert

描述: 文件格式转换 v1.0。md_to_html/html_to_md/md_to_txt/html_to_txt/txt_to_docx/docx_to_pdf/formats。Markdown、HTML、TXT、Word、PDF互转。用户需要格式转换、md转html、txt转word、docx转pdf时使用。input文件或content内容,output输出路径。

脚本: D:\moss-plugins\文档处理\文件格式转换插件\run.bat

参数 JSON:

{
  "type": "object",
  "properties": {
    "action": {"type": "string", "enum": ["md_to_html", "html_to_md", "md_to_txt", "html_to_txt", "txt_to_docx", "docx_to_pdf", "formats"], "description": "转换类型"},
    "input": {"type": "string", "description": "输入文件路径"},
    "output": {"type": "string", "description": "输出文件路径"},
    "content": {"type": "string", "description": "直接传入文本"},
    "title": {"type": "string", "description": "txt_to_docx标题"}
  },
  "required": ["action"]
}

对话示例

场景说法
MD转HTML把 readme.md 转成 HTML
HTML转MD把 page.html 转成 Markdown
TXT转Wordnotes.txt 转成 Word,标题「会议纪要」
Word转PDF把 报告.docx 转成 PDF
查支持有哪些格式可以转换?

常见错误

现象处理
缺 markdown/html2textpip install
docx_to_pdf 失败装 LibreOffice 或 docx2pdf+Word
文件不存在检查 input 路径

能力边界

支持不支持
MD/HTML/TXT/Word/PDF 基础互转复杂 CSS 完美保留
LibreOffice/Word 转 PDFPDF 转 Word
content 字符串输入在线 URL 拉取

配合:pdf_tool 读 PDF · word_tool 编辑 docx · word/excel/ppt 生成文档

详见包内 文件格式转换插件.md