markitdown的安装与简单使用
欢迎阅读我的blog!
个人网站阅读《markitdown 的安装和简单使用》
安装
microsoft/markitdown: Python tool for converting files and office documents to Markdown.
官网给出了两个方法:
目前(20250224),直接使用pip install markitdown会安装markitdown-0.0.1a4,而目前最新版是markitdown-0.0.2a1,故建议用第二种方法从源代码进行构建:
git clone git@github.com:microsoft/markitdown.git
cd markitdown
pip install -e packages/markitdown
主要参数解释
-h, --help:显示帮助信息
-v, --version:显示版本号
-o OUTPUT, --output OUTPUT:指定输出文件名(如果不指定,将输出到控制台)
-d, --use-docintel:使用文档智能服务来提取文本(需要有效的 Document Intelligence 端点)
-p, --use-plugins:使用第三方插件来转换文件
--list-plugins:列出已安装的第三方插件
使用
基本信息
在命令行输入 markitdown -v 会输出版本:
C:\Users\Vanilla>
markitdown 0.0.2a1
输出帮助信息: markitdown -h
测试第三方插件:markitdown --list-plugins
docx文件测试
我选择之前美赛的论文进行测试。
这份完整的数模论文该有的部件都有:公式、图片、表格、题注、多级标题、加粗、斜体、链接、序号、页眉;其中,行间公式使用的是mathtype,行内公式使用的是word自带的公式编辑器。
执行命令
Measure-Command {
markitdown .\MCM-finish.docx -o docx.md
}
部分测试结果
摘要部分

提取结果:
Saving Juneau: Sustainable Development in Tourism
**Summary**
Excessive tourism in Juneau City has caused environmental and social challenges. To address these issues and promote sustainable development, we developed a multi-objective optimization model for sustainable tourism and applied it to Juneau City.
We constructed a general multi-objective optimization model with **tourist numbers** as the decision variable. The **objective function** integrates economic, environmental, and social factors, resulting in six goals. **Constraints** include carbon emissions, water resource utilization, and waste management. Further research will refine this model for application in other cities.
可以发现:
- 页眉完全没有被提取
- 标题
Saving Juneau: Sustainable Development in Tourism原本是标题,这里变成了正常文本 - 加粗正常
目录部分

提取结果:
**Contents**
[1 Introduction 3](#_Toc188935048)
[1.1 Background 3](#_Toc188935049)
[1.2 Restatement of the problem 3](#_Toc188935050)
[1.3 Our works 4](#_Toc188935051)
[2 Model Preparation 4](#_Toc188935052)
[2.1 Assumptions and Justifications 4](#_Toc188935053)
[2.2 Notations 5](#_Toc188935054)
[3 Juneau: A Sustainable Tourism Model 6](#_Toc188935055)
- 原本目录是可以跳转的。可以发现,这里转换的保留了跳转域,但是完全不可用啊……
正文部分

转换结果:
# Introduction
## Background

Figure :Current situation map of Juneau City[1]
In 2023, Juneau, Alaska, hosted 1.6 million cruise passengers, with a daily peak of up to 20,000 visitors. While this influx brought significant economic benefits, it also caused overcrowding and accelerated glacial retreat, impacting natural attractions and potentially deterring future tourists. Additionally, excessive tourism has increased hidden costs related to infrastructure strain, environmental damage, and social challenges.
可以发现:
一级、二级标题格式转换正常
图片似乎是想要转换为base64的格式,但是
内容没有发生转换
图片描述是word自动生成的一句提示“图示描述已自动生成”,但是自动生成的描述去哪里了呢?
图片描述中间还有两个换行符是怎么回事
图片题注变成了正常文本,但是图片序号(包含域信息)消失了
引用直接变成了纯文本
符号说明部分

转换结果:
* **Assumption 2:** Ignoring the carbon footprint caused by tourists' use of transportation within the city of Juneau.
* Justification: Juneau has no direct roads. Most tourists choose cruise ships or planes to reach there. In contrast, the carbon footprint generated by tourists' sightseeing within the city can be negligible.
## Notations
| Notation | Description | Unit |
| --- | --- | --- |
| | Direct income from tourism | USD |
| | The i-th source of direct income from tourism | USD |
| | Tax revenue | USD |
| | Daily water consumption per tourist | L/person/day |
| | Carbon footprint | t |
可以发现:
- 序号转换成功,这里使用的是
*,使用着 - 表格正常转换
- 表格中最左边一列是word公式,全部消失
附录部分

# References
1. Background image source: Travel Juneau. (n.d.). *Home*. <https://www.traveljuneau.com/>
2. LSC Transportation Consultants, Inc. (2024). *Juneau visitor circulator study final report (Prepared for City and Borough of Juneau)*. <https://juneau.org/wp-content/uploads/2024/02/Juneau-Visitor-Circulator-Study-Final-Report-2024-1.pdf>
可以发现:
- 斜体正常
- 链接正常,但是这里直接使用了
<link>的方式而非markdown中更常用的[name](link)
测试总结
| 文档部件 | 转换情况 | 备注 |
|---|---|---|
| 文件类型 | docx | 最新版的word |
| 文件大小 | 16.3MB | 图片较多,分辨率较大;25页,计空格39578字 |
| 转换耗时 | 2.4986917 | 可以说是挺快的了 |
| 公式 | × | 所有公式直接消失了 |
| 图片 | × | 完全不可用 |
| 表格 | √ | |
| 题注 | √ | 变成文字 |
| 多级标题 | √ | 多级标题正常;普通标题变成正常文本 |
| 加粗 | √ | |
| 斜体 | √ | |
| 链接 | √ | |
| 序号 | √ | |
| 页眉 | × | 消失 |
| 目录 | √ | 正常文本,域跳转不可用 |
pdf文件测试
执行命令
Measure-Command {
markitdown .\MCM-finish.pdf -o pdf.md
}
部分测试结果
摘要部分

提取结果:
Problem Chosen
X
2025
MCM/ICM
Summary Sheet
Team Control Number
XXXXXXX
Saving Juneau: Sustainable Development in Tourism
Summary
Excessive tourism in Juneau City has caused environmental and social challenges.
To address these issues and promote sustainable development, we developed a multi-
objective optimization model for sustainable tourism and applied it to Juneau City.
We constructed a general multi-objective optimization model with tourist
numbers as the decision variable. The objective function integrates economic,
environmental, and social factors, resulting in six goals. Constraints include carbon
emissions, water resource utilization, and waste management. Further research will
refine this model for application in other cities.
Task 1: We extended the model by adding sales tax and hotel tax as decision
variables and maximizing tax revenue with related constraints. Using literature review
and linear regression, we determine the values, estimate the parameters and applied the
NSGA-II algorithm to find Pareto optimal solutions. The entropy weight method
可以发现:
- 页眉的文字也能够转换了,虽然格式有点乱,但是至少是有的
- 摘要部分的每一个自动换行都变成了换行符。这应该是与PDF存段落的方式(每行分开存储)有关
- 没有任何的格式(加粗没了)
目录部分

提取结果:
Team#XXXXXXX
Page 2 of 25
Contents
1
Introduction ..................................................................................................... 3
1.1 Background ......................................................................................... 3
1.2 Restatement of the problem ................................................................. 3
1.3 Our works ............................................................................................ 4
2 Model Preparation ........................................................................................... 4
2.1 Assumptions and Justifications ........................................................... 4
2.2 Notations ............................................................................................. 5
3 Juneau: A Sustainable Tourism Model ............................................................ 6
- 页眉部分正常
- 没有能够跳转域信息
- 所见即所得:PDF中的所有文本都被成功的转换了,最大程度的保留了文本信息
正文部分

转换结果:
1 Introduction
1.1 Background
Figure 1:Current situation map of Juneau City[1]
In 2023, Juneau, Alaska, hosted 1.6 million cruise passengers, with a daily peak
of up to 20,000 visitors. While this influx brought significant economic benefits, it also
caused overcrowding and accelerated glacial retreat, impacting natural attractions and
potentially deterring future tourists. Additionally, excessive tourism has increased
hidden costs related to infrastructure strain, environmental damage, and social
challenges.
可以发现:
没有一级、二级标题格式,但是有一级、二级序号
图片完全消失
图片题注当然也没有
引用变成了纯文本
符号说明部分

转换结果:
Justification: Juneau has no direct roads. Most tourists choose cruise ships or
planes to reach there. In contrast, the carbon footprint generated by tourists'
sightseeing within the city can be negligible.
2.2 Notations
Notation
Description
Direct income from tourism
The i-th source of direct income from tourism
Tax revenue
Daily water consumption per tourist
……
Unit
USD
USD
USD
L/person/day
可以发现:
- 序号转换成了不知道是个什么东西:
- 表格格式转换失败,只有文字
- 表格中最左边一列是word公式,全部消失
- 遵循的是先行再列而不是先列再行,不符合逻辑
附录部分

References
[1] Background image source: Travel Juneau. (n.d.). Home. https://www.traveljuneau.com/
[2] LSC Transportation Consultants, Inc. (2024). Juneau visitor circulator study final repo
rt (Prepared for City and Borough of Juneau). https://juneau.org/wp-content/uploads/20
24/02/Juneau-Visitor-Circulator-Study-Final-Report-2024-1.pdf
可以发现:
- 斜体格式消失
- 链接有的正常有的不正常,因为换行会把链接截断
- 链接没有使用markdown的格式而是裸露的网址
测试总结
| 文档部件 | 转换情况 | 备注 |
|---|---|---|
| 文件类型 | ||
| 文件大小 | 5.42MB | 图片较多,分辨率较大;25页,计空格39578字 |
| 转换耗时 | 12.411024 | 比word转md慢,大约是其5倍 |
| 公式 | × | 所有公式直接消失了 |
| 图片 | × | 图片消失 |
| 表格 | × | 表格格式消失 |
| 题注 | √ | 变成文字 |
| 多级标题 | × | 变成(带序号的)正常文本 |
| 加粗 | × | |
| 斜体 | × | |
| 链接 | × | 纯文本,且会被换行截断 |
| 序号 | × | 纯文本 |
| 页眉 | √ | 纯文本 |
| 目录 | √ | 纯正常文本 |
markitdown的安装与简单使用的更多相关文章
- (转)python requests的安装与简单运用
requests是python的一个HTTP客户端库,跟urllib,urllib2类似,那为什么要用requests而不用urllib2呢?官方文档中是这样说明的: python的标准库urllib ...
- MongoDB在Windows下安装、Shell客户端的使用、Bson扩充的数据类型、MongoVUE可视化工具安装和简单使用、Robomongo可视化工具(2)
一.Windows 下载安装 1.去http://www.mongodb.org/downloads下载,mongodb默认安装在C:\Program Files\MongoDB目录下,到F:\Off ...
- python requests的安装与简单运用
requests是python的一个HTTP客户端库,跟urllib,urllib2类似,那为什么要用requests而不用urllib2呢?官方文档中是这样说明的: python的标准库urllib ...
- memcache的windows下的安装和简单使用
原文:memcache的windows下的安装和简单使用 memcache是为了解决网站访问量大,数据库压力倍增的解决方案之一,由于其简单实用,很多站点现在都在使用memcache,但是memcach ...
- 【RabbitMQ】RabbitMQ在Windows的安装和简单的使用
版本说明 使用当前版本:3.5.4 安装与启动 在官网上下载其Server二进制安装包,在Windows上的安装时简单的,与一般软件没什么区别. 安装前会提示你,还需要安装Erlang,并打开下载页面 ...
- Thrift的安装和简单演示样例
本文仅仅是简单的解说Thrift开源框架的安装和简单使用演示样例.对于具体的解说,后面在进行阐述. Thrift简述 ...
- libmemcached安装及简单例子
libmemcached安装及简单例子 1.下载安装libmemcached $ wget http://launchpad.net/libmemcached/1.0/0.44/+download/ ...
- [hadoop系列]Pig的安装和简单演示样例
inkfish原创,请勿商业性质转载,转载请注明来源(http://blog.csdn.net/inkfish ).(来源:http://blog.csdn.net/inkfish) Pig是Yaho ...
- Redis 安装与简单示例
Redis 安装与简单示例 一.Redis的安装 Redis下载地址如下:https://github.com/dmajkic/redis/downloads 解压后根据自己机器的实际情况选择32位或 ...
- Redis 安装与简单使用
安装 Redis 一般系统都会有软件管理工具,但是通常版本都不会太新,况且 Redis 的安装很简单,因此下面使用源码的安装方式. 下载源码 wget http://download.redis.io ...
随机推荐
- kafka开启kerberos认证详细步骤
一.kerberos安装部署 kerberos的基本原理不做过多介绍了,可自行查阅:本文主要介绍kerberos的安装及使用;使用到的软件版本:系统:Red Hat Enterprise Linux ...
- Delphi字符串加密解密函数
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms ...
- 【Linux】3.3 关机、重启和用户登录注销
关机.重启和用户登录注销 1. 关机&重启命令 1.1 shutdown shutdown -h now:表示立即关机 shutdown -h 1:表示1分钟后关机 shutdown -r n ...
- 【电脑】解决DiskGenius调整分区大小时报错“文件使用的簇被标记为空闲或与其它文件有交叉”
[电脑]解决DiskGenius调整分区大小时报错"文件使用的簇被标记为空闲或与其它文件有交叉" 零.报错 在使用DiskGenius对磁盘分区进行调整时,DiskGenius检查 ...
- docker container 启动异常
场景重现 阿里云ECS下新安装的CoreOS 1465.8.0 64-bit,没做过其他任何操作,直接执行以下命令出现异常: docker pull hello-world docker run -i ...
- Spring底层AOP代码实现
一. AOP功能测试 ①. pom.xml 依赖导入 ②. 目标类 ③. 切面类 ④. 配置类 ⑤. 测试类 二. AOP原理-@EnableAspectJAutoProxy AOP原理:[看给容器中 ...
- SAP HANA使用命令行快速导出导入
楔子 今天折腾了接近一下午,就为了使用SAP HANA自带的命令行工具来导出数据备份. SAP HANA(后续简称Hana)是内存数据库,性能这一方面上还真没怕过谁. 由于SAP HANA提供了Han ...
- php和thinkphp实现页面调转
1.原生PHP https://www.cnblogs.com/jade640/p/7118565.html 2.thinkPHP跳转方法及重定向 https://blog.csdn.net/Wake ...
- Sentinel源码—8.限流算法和设计模式总结
大纲 1.关于限流的概述 2.高并发下的四大限流算法原理及实现 3.Sentinel使用的设计模式总结 1.关于限流的概述 保护高并发系统的三把利器:缓存.降级和限流.限流就是通过限制请求的流量以达到 ...
- <HarmonyOS第一课13>给应用添加通知和提醒 #鸿蒙课程##鸿蒙生态#
课程介绍 <HarmonyOS第一课:给应用添加通知和提醒>将引导开发者如何在HarmonyOS应用中实现通知功能.课程首先介绍如何为您的应用添加基础类型通知,包括普通文本.多行文本和图片 ...