Phase 0-2: Schema cleanup, typed relations, event-driven automation

- Phase 0: AGENTS.md cleanup (dedup quotes, renumber sections, merge qmd)
- Phase 1: typed relations (manage-relations.py, graph-search.py, check-staleness.py, detect-conflicts.py)
- Phase 2: frontmatter validator, weekly lint, knowledge promotion, git hooks
- Fix .gitignore to track tools/ and .githooks/
- Fix git remote URL (remove plaintext token)
- New wiki pages: 504 pages, 34 raw sources
This commit is contained in:
hehaiguang1123
2026-07-01 08:05:43 +08:00
parent e544d6e04a
commit a6f05ab2d5
1067 changed files with 522992 additions and 819 deletions
+131
View File
@@ -0,0 +1,131 @@
---
categories:
- "[[LLM Wiki]]"
tags:
- wiki
- concept
- concept/technology
- Python
- 文件转换
- Markdown
- 微软
- 文档处理
- LLM
created: 2026-04-14
source: "https://github.com/microsoft/markitdown"
type: concept
aliases:
- MarkItDown
---
# MarkItDown
## 概述
MarkItDown 是微软开源的 Python 工具,用于将各种文件格式转换为 Markdown,特别适合 LLM 和文本分析场景。
## 支持格式
| 类别 | 格式 |
|------|------|
| 文档 | PDF, Word (.docx), Excel (.xlsx), PowerPoint (.pptx) |
| 媒体 | 图片 (EXIF + OCR), 音频 (EXIF + 转录) |
| 网页 | HTML |
| 数据 | CSV, JSON, XML |
| 其他 | EPUB, ZIP, YouTube, Jupyter Notebooks |
## 安装
```bash
# 创建虚拟环境
python3 -m venv ~/.venv/markitdown
source ~/.venv/markitdown/bin/activate
# 安装(所有依赖)
pip install 'markitdown[all]'
# 或按需安装
pip install 'markitdown[pdf, docx, pptx]'
```
## 使用方式
### 命令行
```bash
# 基本用法
markitdown file.pdf -o output.md
# 从stdin读取
cat file.pdf | markitdown
# 使用Azure Document Intelligence
markitdown file.pdf -d -e "<endpoint>"
```
### Python API
```python
from markitdown import MarkItDown
md = MarkItDown()
result = md.convert("document.xlsx")
print(result.text_content)
```
### 结合LLM进行图片描述
```python
from markitdown import MarkItDown
from openai import OpenAI
md = MarkItDown(
llm_client=OpenAI(),
llm_model="gpt-4o"
)
result = md.convert("image.jpg")
```
## 可选依赖组
| 依赖组 | 说明 |
|--------|------|
| `[all]` | 安装所有可选依赖 |
| `[pdf]` | PDF文件支持 |
| `[docx]` | Word文件支持 |
| `[xlsx]` | Excel文件支持 |
| `[pptx]` | PowerPoint支持 |
| `[audio-transcription]` | 音频转录 |
| `[youtube-transcription]` | YouTube字幕 |
| `[az-doc-intel]` | Azure文档智能 |
## MCP服务器
MarkItDown 提供 MCP (Model Context Protocol) 服务器,可与 Claude Desktop 等应用集成。
详见: `packages/markitdown-mcp`
## Wiki集成
MarkItDown已集成到LLM Wiki工作流:
- 脚本:`~/.openclaw/workspace/04-Tools/wiki-ingest.sh`
- 说明:`~/.openclaw/wiki/markitdown-wiki-integration.md`
## 使用场景
1. **文档索引**: 将Office文档转为Markdown便于搜索
2. **RAG系统**: 为LLM准备格式化文本输入
3. **内容提取**: 从PDF/图片中提取可编辑文本
4. **数据分析**: 将Excel表格转为结构化文本
## 相关链接
- GitHub: https://github.com/microsoft/markitdown
- PyPI: https://pypi.org/project/markitdown/
- NuGet (.NET版): https://www.nuget.org/packages/MarkItDown
---
*本文档由MarkItDown工具转换生成*
*最后更新:2026-04-14*