将word和excel快速转换为markdown格式
- 安装必要组件:
choco install ffmpeg -y
pip install markitdown
- 对docx、doc、xls、xlsx分别设置右键注册表
- 获取markitdown的安装路径:
where markitdown
将获取到的路径信息保存备用。
- 获取本机支持的文件格式版本:
如:查询HKEY_CLASSES_ROOT.docx
右侧默认值显示为Word.Document.12,对应设置项则为HKEY_CLASSES_ROOT\Word.Document.12
更新以下注册表设置文件(我这边直接设置Word.Document和Excel.Sheet开头的所有项目)
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Word.Document.12\shell\转换为 markdown]
[HKEY_CLASSES_ROOT\Word.Document.12\shell\转换为 markdown\command]
@="\"C:\\Users\\Rio\\AppData\\Local\\Programs\\Python\\Python311\\Scripts\\markitdown.exe\" \"%1\" -o \"%1.md\""[HKEY_CLASSES_ROOT\Word.Document.6\shell\转换为 markdown]
[HKEY_CLASSES_ROOT\Word.Document.6\shell\转换为 markdown\command]
@="\"C:\\Users\\Rio\\AppData\\Local\\Programs\\Python\\Python311\\Scripts\\markitdown.exe\" \"%1\" -o \"%1.md\""[HKEY_CLASSES_ROOT\Word.Document.8\shell\转换为 markdown]
[HKEY_CLASSES_ROOT\Word.Document.8\shell\转换为 markdown\command]
@="\"C:\\Users\\Rio\\AppData\\Local\\Programs\\Python\\Python311\\Scripts\\markitdown.exe\" \"%1\" -o \"%1.md\""[HKEY_CLASSES_ROOT\Excel.Sheet.12\shell\转换为 markdown]
[HKEY_CLASSES_ROOT\Excel.Sheet.12\shell\转换为 markdown\command]
@="\"C:\\Users\\Rio\\AppData\\Local\\Programs\\Python\\Python311\\Scripts\\markitdown.exe\" \"%1\" -o \"%1.md\""[HKEY_CLASSES_ROOT\Excel.Sheet.8\shell\转换为 markdown]
[HKEY_CLASSES_ROOT\Excel.Sheet.8\shell\转换为 markdown\command]
@="\"C:\\Users\\Rio\\AppData\\Local\\Programs\\Python\\Python311\\Scripts\\markitdown.exe\" \"%1\" -o \"%1.md\""[HKEY_CLASSES_ROOT\Excel.Sheet.5\shell\转换为 markdown]
[HKEY_CLASSES_ROOT\Excel.Sheet.5\shell\转换为 markdown\command]
@="\"C:\\Users\\Rio\\AppData\\Local\\Programs\\Python\\Python311\\Scripts\\markitdown.exe\" \"%1\" -o \"%1.md\""
将以上注册表设置内容保存为.reg文件,导入注册表即可添加。