Communitygithub.com

David-Li0406/meta-skill-evloving

將檔案和 Office 文件轉換為 Markdown。支援 PDF、DOCX、PPTX、XLSX、圖片(含 OCR)、音訊(含轉錄)、HTML、CSV、JSON、XML、ZIP、YouTube 網址、EPUB 等格式。

meta-skill-evloving 是什麼?

這是一個由 Microsoft 開發的 MarkItDown 工具技能,可將多種常見檔案格式轉換為乾淨、結構化的 Markdown 文字,特別適合用於 LLM 友善的文字處理流程。它支援超過 15 種格式,包括 PDF、DOCX、PPTX、XLSX、圖片(搭配 OCR 光學字元辨識)、音訊(含語音轉錄)、HTML、CSV、JSON、XML、ZIP、EPUB,以及 YouTube 網址(可擷取字幕)。此技能也提供進階功能,例如透過 OpenRouter API 整合 LLM 以生成 AI 增強的圖片描述,以及使用 Azure Document Intelligence 進行專業的 PDF 轉換。它可在命令列或 Python API 中使用,並支援外掛擴充彈性。此外,這項技能在文件轉換過程中會強烈建議加入科學圖表,以提升視覺溝通效果,並可自動產生出圖。

相容平台✓Claude Code✓Codex CLI~Cursor
npx skills add https://github.com/David-Li0406/meta-skill-evloving/tree/HEAD/AgentSkillOS/data/skill_seeds/markitdown

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

MarkItDown - 檔案轉 Markdown 轉換

概述

MarkItDown 是微軟開發的 Python 工具,用於將各種檔案格式轉換為 Markdown。它特別適合將文件轉換為對大型語言模型友善的文字格式,因為 Markdown 對 Token 有效率,且現代語言模型能良好理解。

主要優點:

  • 將文件轉換為乾淨、結構化的 Markdown
  • Token 有效率的格式,適合 LLM 處理
  • 支援 15+ 種檔案格式
  • 可選 AI 增強的圖片描述
  • 圖片與掃描文件的 OCR
  • 音訊檔案的語音轉錄

以科學示意圖進行視覺強化

使用此技能建立文件時,務必考慮加入科學圖表與示意圖,以增進視覺溝通。

若您的文件尚未包含示意圖或圖表:

  • 使用 scientific-schematics 技能生成 AI 驅動的出版品質圖表
  • 只需以自然語言描述您想要的圖表
  • Nano Banana Pro 會自動生成、審查並優化示意圖

對於新文件: 預設應生成科學示意圖,以視覺化呈現文字中描述的關鍵概念、工作流程、架構或關係。

如何生成示意圖:

python scripts/generate_schematic.py "您的圖表描述" -o figures/output.png

AI 將自動:

  • 建立格式正確的出版品質圖像
  • 透過多次迭代審查與優化
  • 確保無障礙性(色盲友善、高對比度)
  • 將輸出儲存在 figures/ 目錄中

何時加入示意圖:

  • 文件轉換工作流程圖
  • 檔案格式架構圖解
  • OCR 處理管線圖
  • 整合工作流程圖
  • 系統架構圖
  • 資料流程圖
  • 任何適合以視覺化呈現的複雜概念

如需建立示意圖的詳細指引,請參閱 scientific-schematics 技能文件。


支援的格式

格式描述備註
PDF可攜式文件格式完整文字提取
DOCXMicrosoft Word保留表格、格式
PPTXPowerPoint投影片含備註
XLSXExcel 試算表表格與資料
圖片JPEG、PNG、GIF、WebPEXIF 元資料 + OCR
音訊WAV、MP3元資料 + 轉錄
HTML網頁乾淨轉換
CSV逗號分隔值表格格式
JSONJSON 資料結構化表示
XMLXML 文件結構化格式
ZIP壓縮檔遍歷內容
EPUB電子書完整文字提取
YouTube影片網址擷取轉錄

快速開始

安裝

# 安裝所有功能
pip install 'markitdown[all]'

# 或者從原始碼安裝
git clone https://github.com/microsoft/markitdown.git
cd markitdown
pip install -e 'packages/markitdown[all]'

命令列使用

# 基本轉換
markitdown document.pdf > output.md

# 指定輸出檔案
markitdown document.pdf -o output.md

# 管道內容
cat document.pdf | markitdown > output.md

# 啟用外掛程式
markitdown --list-plugins  # 列出可用的外掛程式
markitdown --use-plugins document.pdf -o output.md

Python API

from markitdown import MarkItDown

# 基本使用
md = MarkItDown()
result = md.convert("document.pdf")
print(result.text_content)

# 從串流轉換
with open("document.pdf", "rb") as f:
    result = md.convert_stream(f, file_extension=".pdf")
    print(result.text_content)

進階功能

1. AI 增強的圖片描述

經由 OpenRouter 使用 LLM 生成詳細的圖片描述(適用於 PPTX 和圖片檔案):

from markitdown import MarkItDown
from openai import OpenAI

# 初始化 OpenRouter 客戶端(OpenAI 相容 API)
client = OpenAI(
    api_key="您的-openrouter-api-key",
    base_url="https://openrouter.ai/api/v1"
)

md = MarkItDown(
    llm_client=client,
    llm_model="anthropic/claude-sonnet-4.5",  # 推薦用於科學視覺
    llm_prompt="詳細描述此圖片以用於科學文件"
)

result = md.convert("presentation.pptx")
print(result.text_content)

2. Azure Document Intelligence

使用 Microsoft Document Intelligence 進行增強的 PDF 轉換:

# 命令列
markitdown document.pdf -o output.md -d -e "<document_intelligence_endpoint>"
# Python API
from markitdown import MarkItDown

md = MarkItDown(docintel_endpoint="<document_intelligence_endpoint>")
result = md.convert("complex_document.pdf")
print(result.text_content)

3. 外掛程式系統

MarkItDown 支援第三方外掛程式來擴充功能:

# 列出已安裝的外掛程式
markitdown --list-plugins

# 啟用外掛程式
markitdown --use-plugins file.pdf -o output.md

在 GitHub 上使用標籤尋找外掛程式:#markitdown-plugin

選擇性依賴項

控制您要支援的檔案格式:

# 安裝特定格式
pip install 'markitdown[pdf, docx, pptx]'

# 所有可用選項:
# [all]                  - 所有選擇性依賴項
# [pptx]                 - PowerPoint 檔案
# [docx]                 - Word 文件
# [xlsx]                 - Excel 試算表
# [xls]                  - 較舊的 Excel 檔案
# [pdf]                  - PDF 文件
# [outlook]              - Outlook 郵件
# [az-doc-intel]         - Azure Document Intelligence
# [audio-transcription]  - WAV 和 MP3 轉錄
# [youtube-transcription] - YouTube 影片轉錄

常見使用案例

1. 將科學論文轉換為 Markdown

from markitdown import MarkItDown

md = MarkItDown()

# 轉換 PDF 論文
result = md.convert("research_paper.pdf")
with open("paper.md", "w") as f:
    f.write(result.text_content)

2. 從 Excel 提取資料進行分析

from markitdown import MarkItDown

md = MarkItDown()
result = md.convert("data.xlsx")

# 結果將為 Markdown 表格格式
print(result.text_content)

3. 處理多個文件

from markitdown import MarkItDown
import os
from pathlib import Path

md = MarkItDown()

# 處理目錄中所有 PDF
pdf_dir = Path("papers/")
output_dir = Path("markdown_output/")
output_dir.mkdir(exist_ok=True)

for pdf_file in pdf_dir.glob("*.pdf"):
    result = md.convert(str(pdf_file))
    output_file = output_dir / f"{pdf_file.stem}.md"
    output_file.write_text(result.text_content)
    print(f"已轉換:{pdf_file.name}")

4. 轉換 PowerPoint 並加入 AI 描述

from markitdown import MarkItDown
from openai import OpenAI

# 使用 OpenRouter 存取多個 AI 模型
client = OpenAI(
    api_key="您的-openrouter-api-key",
    base_url="https://openrouter.ai/api/v1"
)

md = MarkItDown(
    llm_client=client,
    llm_model="anthropic/claude-sonnet-4.5",  # 推薦用於簡報
    llm_prompt="詳細描述此投影片圖片,重點關注關鍵視覺元素與資料"
)

result = md.convert("presentation.pptx")
with open("presentation.md", "w") as f:
    f.write(result.text_content)

5. 批次轉換不同格式

from markitdown import MarkItDown
from pathlib import Path

md = MarkItDown()

# 要轉換的檔案
files = [
    "document.pdf",
    "spreadsheet.xlsx",
    "presentation.pptx",
    "notes.docx"
]

for file in files:
    try:
        result = md.convert(file)
        output = Path(file).stem + ".md"
        with open(output, "w") as f:
            f.write(result.text_content)
        print(f"✓ 已轉換 {file}")
    except Exception as e:
        print(f"✗ 轉換 {file} 時發生錯誤:{e}")

6. 提取 YouTube 影片轉錄

from markitdown import MarkItDown

md = MarkItDown()

# 將 YouTube 影片轉換為逐字稿
result = md.convert("https://www.youtube.com/watch?v=VIDEO_ID")
print(result.text_content)

Docker 使用

# 建置映像檔
docker build -t markitdown:latest .

# 執行轉換
docker run --rm -i markitdown:latest < ~/document.pdf > output.md

最佳實踐

1. 選擇正確的轉換方法

  • 簡單文件:使用基本 MarkItDown()
  • 複雜 PDF:使用 Azure Document Intelligence
  • 視覺內容:啟用 AI 圖片描述
  • 掃描文件:確保已安裝 OCR 依賴項

2. 優雅地處理錯誤

from markitdown import MarkItDown

md = MarkItDown()

try:
    result = md.convert("document.pdf")
    print(result.text_content)
except FileNotFoundError:
    print("檔案未找到")
except Exception as e:
    print(f"轉換錯誤:{e}")

3. 高效處理大型檔案

from markitdown import MarkItDown

md = MarkItDown()

# 對於大型檔案,使用串流
with open("large_file.pdf", "rb") as f:
    result = md.convert_stream(f, file_extension=".pdf")
    
    # 分塊處理或直接儲存
    with open("output.md", "w") as out:
        out.write(result.text_content)

4. 針對 Token 效率最佳化

Markdown 輸出已具備 Token 效率,但您可以:

  • 移除過多的空白
  • 合併相似章節
  • 如不需要則移除元資料
from markitdown import MarkItDown
import re

md = MarkItDown()
result = md.convert("document.pdf")

# 清理多餘空白
clean_text = re.sub(r'\n{3,}', '\n\n', result.text_content)
clean_text = clean_text.strip()

print(clean_text)

與科學工作流程的整合

轉換文獻以供審查

from markitdown import MarkItDown
from pathlib import Path

md = MarkItDown()

# 轉換 literature 資料夾中所有論文
papers_dir = Path("literature/pdfs")
output_dir = Path("literature/markdown")
output_dir.mkdir(exist_ok=True)

for paper in papers_dir.glob("*.pdf"):
    result = md.convert(str(paper))
    
    # 儲存含元資料
    output_file = output_dir / f"{paper.stem}.md"
    content = f"# {paper.stem}\n\n"
    content += f"**來源**:{paper.name}\n\n"
    content += "---\n\n"
    content += result.text_content
    
    output_file.write_text(content)

# 使用 AI 增強的圖形轉換
from openai import OpenAI

client = OpenAI(
    api_key="您的-openrouter-api-key",
    base_url="https://openrouter.ai/api/v1"
)

md_ai = MarkItDown(
    llm_client=client,
    llm_model="anthropic/claude-sonnet-4.5",
    llm_prompt="以技術精確度描述科學圖形"
)

提取表格進行分析

from markitdown import MarkItDown
import re

md = MarkItDown()
result = md.convert("data_tables.xlsx")

# Markdown 表格可直接解析或使用
print(result.text_content)

疑難排解

常見問題

  1. 缺少依賴項:安裝特定功能套件

    pip install 'markitdown[pdf]'  # 用於 PDF 支援
    
  2. 二進位檔案錯誤:確保以二進位模式開啟檔案

    with open("file.pdf", "rb") as f:  # 注意是 "rb"
        result = md.convert_stream(f, file_extension=".pdf")
    
  3. OCR 無法運作:安裝 tesseract

    # macOS
    brew install tesseract
    
    # Ubuntu
    sudo apt-get install tesseract-ocr
    

效能考量

  • PDF 檔案:大型 PDF 可能耗時;若支援,可考慮指定頁面範圍
  • 圖片 OCR:OCR 處理為 CPU 密集型
  • 音訊轉錄:需要額外的運算資源
  • AI 圖片描述:需要 API 呼叫(可能產生費用)

後續步驟

  • 參閱 references/api_reference.md 了解完整的 API 文件
  • 檢查 references/file_formats.md 了解格式特定細節
  • 查看 scripts/batch_convert.py 了解自動化範例
  • 探索 scripts/convert_with_ai.py 了解 AI 增強的轉換

資源

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

David-Li0406/meta-skill-evloving

Browser automation with persistent page state. Use when users ask to navigate websites, fill forms, take screenshots, extract web data, test web apps, or automate browser workflows. Trigger phrases include "go to [url]", "click on", "fill out the form", "take a screenshot", "scrape", "automate", "test the website", "log into", or any browser interaction request.

David-Li0406/meta-skill-evloving

Create technical diagrams using Mermaid syntax for architecture, sequences, ERDs, flowcharts, and state machines. Use for visualizing system design, data flows, and processes. Triggers: diagram, mermaid, architecture diagram, sequence diagram, flowchart, ERD, entity relationship, state diagram, C4 model, component diagram, visualize, draw.

David-Li0406/meta-skill-evloving

Comprehensive document creation, editing, and analysis with support for tracked changes, comments, formatting preservation, and text extraction. When Claude needs to work with professional documents (.docx files) for: (1) Creating new documents, (2) Modifying or editing content, (3) Working with tracked changes, (4) Adding comments, or any other document tasks

David-Li0406/meta-skill-evloving

Complete color manipulation and green screen effects system. PROACTIVELY activate for: (1) Green screen/chromakey removal, (2) Color grading with LUTs, (3) Color correction (levels, curves, white balance), (4) Colorkey/color removal effects, (5) Hue/saturation manipulation, (6) Color space conversions (BT.709, BT.2020, HDR), (7) Color isolation effects, (8) Teal and orange look, (9) Vintage/film looks, (10) Color keying for transparency. Provides: chromakey and colorkey filters, LUT application (lut3d), curves and levels adjustment, color balance, selective color manipulation, color space handling, HDR tone mapping, professional color grading chains.

David-Li0406/meta-skill-evloving

Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).

David-Li0406/meta-skill-evloving

Build with OpenAI's stateless APIs - Chat Completions (GPT-5, GPT-4o), Embeddings, Images (DALL-E 3), Audio (Whisper + TTS), and Moderation. Includes Node.js SDK and fetch-based approaches for Cloudflare Workers. Use when: implementing chat completions with GPT-5/GPT-4o, streaming responses with SSE, using function calling/tools, creating structured outputs with JSON schemas, generating embeddings for RAG (text-embedding-3-small/large), generating images with DALL-E 3, editing images with GPT-Image-1, transcribing audio with Whisper, synthesizing speech with TTS (11 voices), moderating content (11 safety categories), or troubleshooting rate limits (429), invalid API keys (401), function calling failures, streaming parse errors, embeddings dimension mismatches, or token limit exceeded.

David-Li0406/meta-skill-evloving

Comprehensive PDF manipulation toolkit for extracting text and tables, creating new PDFs, merging/splitting documents, and handling forms. When Claude needs to fill in a PDF form or programmatically process, generate, or analyze PDF documents at scale.

David-Li0406/meta-skill-evloving

Presentation creation, editing, and analysis. When Claude needs to work with presentations (.pptx files) for: (1) Creating new presentations, (2) Modifying or editing content, (3) Working with layouts, (4) Adding comments or speaker notes, or any other presentation tasks

David-Li0406/meta-skill-evloving

Comprehensive spreadsheet creation, editing, and analysis with support for formulas, formatting, data analysis, and visualization. When Claude needs to work with spreadsheets (.xlsx, .xlsm, .csv, .tsv, etc) for: (1) Creating new spreadsheets with formulas and formatting, (2) Reading or analyzing data, (3) Modify existing spreadsheets while preserving formulas, (4) Data analysis and visualization in spreadsheets, or (5) Recalculating formulas

David-Li0406/meta-skill-evloving

Download YouTube videos with customizable quality and format options. Use this skill when the user asks to download, save, or grab YouTube videos. Supports various quality settings (best, 1080p, 720p, 480p, 360p), multiple formats (mp4, webm, mkv), and audio-only downloads as MP3.

David-Li0406/meta-skill-evloving

Best practices for Remotion - Video creation in React

David-Li0406/meta-skill-evloving

Provides bidirectional translation (Chinese/English), grammar checking, and sentence polishing. Supports specific tense constraints, context-aware tone adjustment, and natural expression optimization. Outputs direct text without formatting.

David-Li0406/meta-skill-evloving

指导如何通过自定义注解(如@Unicom)标识Dubbo接口,利用BeanDefinitionRegistryPostProcessor在启动时扫描并动态注册ReferenceBean,实现RPC调用的封装。

David-Li0406/meta-skill-evloving

生成Python脚本,利用FFmpeg将图片序列按3x3布局合并,或将合并图拆分。要求使用subprocess模块执行命令,并支持用户交互式输入路径。

David-Li0406/meta-skill-evloving

SOP for extracting and analyzing promotional activity details, handling time formatting, location mapping, payment logic, and step-by-step process validation.

David-Li0406/meta-skill-evloving

Specializes in creating TikTok short video scripts using an anthropomorphic 'Chef' perspective to explain wildlife food chains and survival environments, utilizing real field footage.

David-Li0406/meta-skill-evloving

针对TikTok平台,以拟人化视角(如动物作为厨师)创作系列短视频脚本。重点介绍野生动物、食物链及生态环境,要求使用野外实拍素材,风格幽默且具有教育意义。

David-Li0406/meta-skill-evloving

Generates KWL (Know, Want to know, Learned) charts for educational videos, specifically BrainPOP, using simple 7th-grade language and short, concise bullet points.

David-Li0406/meta-skill-evloving

Develops DAX measures to calculate promo and regular volumes and generates a calculated table of dates excluding continuous promo date ranges, handling multiple periods and nulls.

David-Li0406/meta-skill-evloving

Tracks complex, multi-session work using the Beads issue tracker and dependency graphs, and provides persistent memory that survives conversation compaction. Use when work spans multiple sessions, has complex dependencies, or needs persistent context across compaction cycles. Trigger with phrases like "create task for", "what's ready to work on", "show task", "track this work", "what's blocking", or "update status".

相關技能