[league/html-to-markdown]一个将HTML转Markdown的库

2022-03-28 奥古斯宏

这是一个将HTML转为markdown的库,

使用方式很简单:

use League\HTMLToMarkdown\HtmlConverter;

$converter = new HtmlConverter();

$html = "<h3>Quick, to the Batpoles!</h3>";
$markdown = $converter->convert($html);

为什么要将HTML转换为Markdown呢?一般在什么情况下能用到呢?

  • 有一篇很好的文章,但你只能复制出HTML,而如果你需要Markdown,就能用到这个库了
  • 你抓取到的文章是HTML的,但你希望作为Markdown存储和编辑
  • 希望将HTML转为纯文本,作为邮件发送
  • 你希望将你原有的HTML格式的文档笔记转为Markdown的编辑方式
  • 单纯的喜欢用Markdown

它支持更多的配置项,比如单独设置换行/样式/链接等.

最近浏览
IP用户:34.156.*.*
10 小时前 Velen Public Web Crawler
IP用户:1.61.*.*
2 天前 Chrome Mac 10.15
IP用户:64.90.*.*
4 天前 Generic Bot
IP用户:144.76.*.*
5 天前 serpstatbot
IP用户:78.164.*.*
5 天前 Opera Windows NT
IP用户:61.149.*.*
5 天前 Chrome Mac 10.15
IP用户:183.241.*.*
5 天前 Chrome Mac 10.15
IP用户:43.132.*.*
7 天前 Chrome Windows 10
IP用户:223.91.*.*
9 天前 Microsoft Edge Windows 10
IP用户:123.55.*.*
9 天前 Chrome Mac 10.15
IP用户:209.207.*.*
10 天前 Chrome Mac 10.15
IP用户:37.27.*.*
13 天前 Generic Bot
累计浏览次数:2512
评论
点击登录
phpreturn,PHP武器库,专注PHP领域的项目和资讯,收录和介绍PHP相关项目。

本站所有权利归 phpreturn.com 所有

举报/反馈/投稿邮箱:phpreturn@ulthon.com

鲁ICP备19027671号-2