mirror of
https://gitee.com/ulthon/ulthon_information.git
synced 2026-03-03 16:24:28 +08:00
markdown支表格转换
This commit is contained in:
@@ -7,6 +7,7 @@ namespace app\model;
|
|||||||
use app\common\model\Base;
|
use app\common\model\Base;
|
||||||
use app\common\tools\PostBlock;
|
use app\common\tools\PostBlock;
|
||||||
use app\common\tools\PostShow;
|
use app\common\tools\PostShow;
|
||||||
|
use League\HTMLToMarkdown\Converter\TableConverter;
|
||||||
use League\HTMLToMarkdown\HtmlConverter;
|
use League\HTMLToMarkdown\HtmlConverter;
|
||||||
use think\facade\Cache;
|
use think\facade\Cache;
|
||||||
use think\facade\Request;
|
use think\facade\Request;
|
||||||
@@ -166,6 +167,8 @@ class Post extends Base
|
|||||||
|
|
||||||
$converter = new HtmlConverter(array('strip_tags' => true));
|
$converter = new HtmlConverter(array('strip_tags' => true));
|
||||||
|
|
||||||
|
$converter->getEnvironment()->addConverter(new TableConverter());
|
||||||
|
|
||||||
$markdown = $converter->convert($content_html);
|
$markdown = $converter->convert($content_html);
|
||||||
|
|
||||||
return $markdown;
|
return $markdown;
|
||||||
|
|||||||
Reference in New Issue
Block a user