Skill站外收录 @skilllib/skill-2014279396771704834
markitdown
将各类文件统一转换为结构清晰、适合大模型处理的 Markdown 格式,涵盖 PDF 和 Office 文档的文字提取与排版还原、图像 OCR 识别、音频语音转录、网页及 YouTube 内容抓取、CSV JSON 等结构化数据表格化,支持批量处理与 ZIP 解压转换。
内容与媒体 AI 技能
Skills.MD
# MarkItDown
## Overview
MarkItDown is a Python utility that converts various file formats into Markdown format, optimized for use with large language models and text analysis pipelines. It preserves document structure (headings, lists, tables, hyperlinks) while producing clean, token-efficient Markdown output.
## When to Use This Skill
Use this skill when users request:
- Converting documents to Markdown format
- Extracting text from PDF, Word, PowerPoint, or Excel files
- Performing OCR on images to extract text
- Transcribing audio files to text
- Extracting YouTube video transcripts
- Processing HTML, EPUB, or web content to Markdown
- Converting structured data (CSV, JSON, XML) to readable Markdown
- Batch converting multiple files or ZIP archives
- Preparing documents for LLM analysis or RAG systems
## Core Capabilities
### 1. Document Conversion
Convert Office documents and PDFs to Markdown while preserving structure.
**Supported formats:**
- PDF files (with optional Azure Document Intelligence integration)
- Word documents (DOCX)
- PowerPoint presentations (PPTX)
- Excel spreadsheets (XLSX, XLS)
**Basic usage:**
```python
from markitdown import MarkItDown
md = MarkItDown()
result = md.convert("document.pdf")
print(result.text_content)
```
**Command-line:**
```bash
markitdown document.pdf -o output.md
```
See `references/document_conversion.md` for detailed documentation on document-specific features.
### 2. Media Processing
Extract text from images using OCR and transcribe audio files to text.
**Supported formats:**
- Images (JPEG, PNG, GIF, etc.) with EXIF metadata extraction
- Audio files with speech transcription (requires speech_recognition)
**Image with OCR:**
```python
from markitdown import MarkItDown
md = MarkItDown()
result = md.convert("image.jpg")
print(result.text_content) # Includes EXIF metadata and OCR text
```
**Audio transcription:**
```python
result = md.convert("audio.wav")
print(result.text_content) # Transcribed speech
```
See `references/media_processing.md` for advanced media handling options.
### 3. Web Content Extraction
Convert web-based content and e-books to Markdown.
**Supported formats:**
- HTML files and web pages
- YouTube video transcripts (via URL)
- EPUB books
- RSS feeds
**YouTube transcript:**
```python
from markitdown import MarkItDown
md = MarkItDown()
result = md.convert("https://youtube.com/watch?v=VIDEO_ID")
print(result.text_content)
```
See `references/web_content.md` for web extraction details.
### 4. Structured Data Handling
Convert structured data formats to readable Markdown tables.
**Supported formats:**
- CSV files
- JSON files
- XML files
**CSV to Markdown table:**
```python
from markitdown import MarkItDown
md = MarkItDown()
result = md.convert("data.csv")
print(result.text_content) # Formatted as Markdown table
```
See `references/structured_data.md` for format-specific options.
### 5. Advanced Integrations
Enhance conversion quality with AI-powered features.
**Azure Document Intelligence:**
For enhanced PDF processing with better table extraction and layout analysis:
```python
from markitdown import MarkItDown
md = MarkItDown(docintel_endpoint="<endpoint>", docintel_key="<key>")
result = md.convert("complex.pdf")
```
**LLM-Powered Image Descriptions:**
Generate detailed image descriptions using GPT-4o:
```python
from markitdown import MarkItDown
from openai import OpenAI
client = OpenAI()
md = MarkItDown(llm_client=client, llm_model="gpt-4o")
result = md.convert("presentation.pptx") # Images described with LLM
```
See `references/advanced_integrations.md` for integration details.
### 6. Batch Processing
Process multiple files or entire ZIP archives at once.
**ZIP file processing:**
```python
from markitdown import MarkItDown
md = MarkItDown()
result = md.convert("archive.zip")
print(result.text_content) # All files converted and concatenated
```
**Batch script:**
Use the provided batch processing script for directory conversion:
```bash
python scripts/batch_convert.py /path/to/documents /path/to/output
```
See `scripts/batch_convert.py` for implementation details.
## Installation
**Full installation (all features):**
```bash
pip install 'markitdown[all]'
```
**Modular installation (specific features):**
```bash
pip install 'markitdown[pdf]' # PDF support
pip install 'markitdown[docx]' # Word support
pip install 'markitdown[pptx]' # PowerPoint support
pip install 'markitdown[xlsx]' # Excel support
pip install 'markitdown[audio]' # Audio transcription
pip install 'markitdown[youtube]' # YouTube transcripts
```
**Requirements:**
- Python 3.10 or higher
## Output Format
MarkItDown produces clean, token-efficient Markdown optimized for LLM consumption:
- Preserves headings, lists, and tables
- Maintains hyperlinks and formatting
- Includes metadata where relevant (EXIF, document properties)
- No temporary files created (streaming approach)
## Common Workflows
**Preparing documents for RAG:**
```python
from markitdown import MarkItDown
md = MarkItDown()
# Convert knowledge base documents
docs = ["manual.pdf", "guide.docx", "faq.html"]
markdown_content = []
for doc in docs:
result = md.convert(doc)
markdown_content.append(result.text_content)
# Now ready for embedding and indexing
```
**Document analysis pipeline:**
```bash
# Convert all PDFs in directory
for file in documents/*.pdf; do
markitdown "$file" -o "markdown/$(basename "$file" .pdf).md"
done
```
## Plugin System
MarkItDown supports extensible plugins for custom conversion logic. Plugins are disabled by default for security:
```python
from markitdown import MarkItDown
# Enable plugins if needed
md = MarkItDown(enable_plugins=True)
```
## Resources
This skill includes comprehensive reference documentation for each capability:
- **references/document_conversion.md** - Detailed PDF, DOCX, PPTX, XLSX conversion options
- **references/media_processing.md** - Image OCR and audio transcription details
- **references/web_content.md** - HTML, YouTube, and EPUB extraction
- **references/structured_data.md** - CSV, JSON, XML conversion formats
- **references/advanced_integrations.md** - Azure Document Intelligence and LLM integration
- **scripts/batch_convert.py** - Batch processing utility for directories
评论 0
还没有评论,来抢沙发。
相关内容
同类或同场景的收录内容
building-with-kafka-strimzi
在 Kubernetes 上构建基于 Apache Kafka 的事件驱动系统,支持高可靠的消息传递、事务性处理与精确一次语义,结合 Strimzi 运营商实现集群自动化管理,利用 Schema Registry 保障事件模式演进,适用于微服务间解耦通信与实时数据流处理场景。
站外数据与分析
609 0.0
personal-tool-builder
专注于从个人真实痛点出发快速构建实用工具,涵盖命令行程序、本地优先应用和自动化脚本的开发与演进,强调先满足自身需求再逐步扩展,通过持续自用打磨功能,避免过度设计,确保工具简洁有效且长期可维护。
站外商业与营销
196 0.0
threejs-lighting
实现三维场景中的光照与阴影控制,支持多种光源类型及环境光照明,提供从基础布光到高级阴影优化的完整方案,适用于需要真实感渲染或性能平衡的可视化项目。
站外效率工具
442 0.0
aggregation-helper
提供数据聚合场景的自动化辅助能力,涵盖 SQL 查询编写、统计分析建模、可视化方案设计及商业智能配置,支持从需求理解到生产级代码生成的全流程指导。
站外效率工具数据与分析
217 0.0
举报「markitdown」
举报信息仅审核团队可见,同一资产 24 小时内仅可举报一次