feat: restore sablog browse modes and clean imported HTML
Keep the public site readable after import (nbsp, highlighter, wrapping code, compact pager) and finish the admin extras already in this tree: sticky levels, preview, page cache, and live llms.txt. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Blog\Support\SablogHtmlNormalizer;
|
||||
use App\Models\Post;
|
||||
use Illuminate\Console\Command;
|
||||
use League\HTMLToMarkdown\HtmlConverter;
|
||||
@@ -36,6 +37,7 @@ class ConvertContent extends Command
|
||||
]);
|
||||
|
||||
$renderer = app(\App\Blog\Services\PostContentRenderer::class);
|
||||
$normalizer = app(SablogHtmlNormalizer::class);
|
||||
|
||||
$posts = $query->get();
|
||||
if ($posts->isEmpty()) {
|
||||
@@ -49,7 +51,7 @@ class ConvertContent extends Command
|
||||
|
||||
foreach ($posts as $post) {
|
||||
// [attach=xx] 是 markdown 保留字符,先换成令牌,渲染时再解析
|
||||
$markdown = $converter->convert($renderer->toMarkdownSafeTokens($post->content));
|
||||
$markdown = $normalizer->toMarkdown((string) $post->content, $converter, $renderer);
|
||||
|
||||
if ($this->option('dry-run')) {
|
||||
$this->newLine();
|
||||
|
||||
Reference in New Issue
Block a user