dongpao1873 2016-06-25 09:38
浏览 99

使用PHP将文档记录到Markdown

I was wondering is there a way to convert a document(doc or docx), which contains images and text into a markdown.
Ex: Document contains an Image and description for that image
I was trying to convert that document into a markdown such as follows

<img src="doument_name/media/image1.png" width="624" height="505" />
Followed by description with markdown

When I search, I only found Markdown parser's, converters which convert text data into HTML

  • 写回答

1条回答 默认 最新

  • doucan2102 2016-06-25 10:30
    关注

    Doc and Docx are complex proprietary formats, and markdown is not widely used. Converting one to the other directly will be difficult. It's better to use HTML as the intermediate step.

    There are many PHP solutions out there to read MS-docs, but, as you perhaps have found, they're all slightly flawed. They also don't do the conversion to HTML, they read, but don't convert, or they don't include images, etc.

    As an alternative you could try an online API, like:

    http://apiv2.online-convert.com/

    I haven't tested this, but it could be a good solution: It converts to HTML, and you have to write, and maintain, very little code yourself.

    The conversion from HTML to markdown is relatively easy, you can find examples online:

    https://github.com/thephpleague/html-to-markdown

    https://github.com/Elephant418/Markdownify

    评论

报告相同问题?

悬赏问题

  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序
  • ¥15 onvif+openssl,vs2022编译openssl64
  • ¥15 iOS 自定义输入法-第三方输入法