mcpField
M
markdown-converter

markdown-converter

github.com/steipete文档处理7.4k341 次安装1 周前更新
代码仓库

关于 markdown-converter

通过 `uvx` 调用 `markitdown`,将文件及其他输入转换为 Markdown。支持文档、数据和媒体格式,并可指定输出文件及解析提示。

主要功能

  1. 01将文档转换为 Markdown
  2. 02支持网页与数据格式
  3. 03提取图像和音频内容
  4. 04读取 ZIP 内容及 YouTube URL
  5. 05设置输出文件和输入格式提示

适用场景

  1. 01将 PDF 报告转换为 Markdown
  2. 02提取电子表格中的表格
  3. 03将演示文稿转为 Markdown 文件
  4. 04为文本工作流转换媒体或网页数据

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/steipete/agent-scripts --skill markdown-converter

安装后在 Claude Code 中输入/markdown-converter确认已加载。

详细介绍

Markdown 转换器

使用 uvx --from "markitdown[all]" markitdown 将文件转换为 Markdown,无需安装。

基本用法

# Convert to stdout
uvx --from "markitdown[all]" markitdown input.pdf

# Save to file
uvx --from "markitdown[all]" markitdown input.pdf -o output.md
uvx --from "markitdown[all]" markitdown input.docx > output.md

# From stdin
cat input.pdf | uvx --from "markitdown[all]" markitdown

支持的格式

  • 文档:PDF、Word(.docx)、PowerPoint(.pptx)、Excel(.xlsx、.xls)
  • Web/数据:HTML、CSV、JSON、XML
  • 媒体:图像(EXIF + OCR)、音频(EXIF + 转录)
  • 其他:ZIP(遍历内容)、YouTube URL、EPub

选项

-o OUTPUT      # Output file
-x EXTENSION   # Hint file extension (for stdin)
-m MIME_TYPE   # Hint MIME type
-c CHARSET     # Hint charset (e.g., UTF-8)
-d             # Use Azure Document Intelligence
-e ENDPOINT    # Document Intelligence endpoint
--use-plugins  # Enable 3rd-party plugins
--list-plugins # Show installed plugins

示例

# Convert Word document
uvx --from "markitdown[all]" markitdown report.docx -o report.md

# Convert Excel spreadsheet
uvx --from "markitdown[all]" markitdown data.xlsx > data.md

# Convert PowerPoint presentation
uvx --from "markitdown[all]" markitdown slides.pptx -o slides.md

# Convert with file type hint (for stdin)
cat document | uvx --from "markitdown[all]" markitdown -x .pdf > output.md

# Use Azure Document Intelligence for better PDF extraction
uvx --from "markitdown[all]" markitdown scan.pdf -d -e "https://your-resource.cognitiveservices.azure.com/"

注意事项

  • 输出会保留文档结构:标题、表格、列表、链接
  • 首次运行时会缓存依赖项;后续运行速度更快
  • 对于提取效果不佳的复杂 PDF,可结合 Azure Document Intelligence 使用 -d
  • 如果自动字符集检测为文本文件选错了编码,请传入 -c UTF-8(或已知字符集)

评论

支持 Markdown