ppito / contentful-html-to-rich-text
Contentful - HTML 到富文本
1.0.5
2022-10-15 08:05 UTC
Requires
- php: ^7.3 || ^8.0
- neitanod/forceutf8: ~2.0
This package is auto-updated.
Last update: 2024-09-15 12:23:30 UTC
README
一个用于将基本 HTML 转换为 Contentful 富文本的库。
安装
使用 Composer
composer require ppito/contentful-html-to-rich-text
使用方法
基本
<?php // composer require contentful/contentful-management require __DIR__ . '/vendor/autoload.php'; $content = \Contentful\HtmlToRichText\Tool::parse("<p>Hello</p><p>Another with <strong>bold maybe?</strong></p>");
支持的
该库将自动转换以下 HTML 标签
h1
h2
h3
h4
h5
h6
div
p
ul
ol
li
blockquote
br
hr
a
span
strong
b
u
em
i
code
section
footer
header
nav
aside
不支持的
HTML 属性不支持(如 id=""
,class=""
,style=""
等)