feat: use xpier media library for uploads and markdown embeds
Store media:ID in post bodies instead of CDN URLs, and keep sablog attach tokens as a fallback. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Blog\Services;
|
||||
|
||||
use App\Blog\Support\MarkdownMediaEmbed;
|
||||
use App\Models\Post;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use League\CommonMark\Environment\Environment;
|
||||
@@ -36,11 +37,15 @@ class PostContentRenderer
|
||||
*/
|
||||
public function render(Post $post): string
|
||||
{
|
||||
$embed = app(MarkdownMediaEmbed::class);
|
||||
$raw = (string) $post->content;
|
||||
|
||||
$content = $post->content_format === 'markdown'
|
||||
? $this->toHtml($post->content)
|
||||
: $post->content;
|
||||
? $this->toHtml($embed->expandMarkdown($raw))
|
||||
: $raw;
|
||||
|
||||
$html = $this->renderShortcodes($content, $post);
|
||||
$html = $embed->hydrateHtml($html);
|
||||
|
||||
// 插件钩子:付费内容过滤、AI 处理等
|
||||
$html = app(\App\Blog\Support\PluginManager::class)->applyFilters('post.rendered', $html, $post);
|
||||
|
||||
Reference in New Issue
Block a user