feat(ext-blog): Add Markdown support and featured images to Plugi Blog Extension
Updated README.md to document Markdown rendering and image authoring capabilities. Added PostContentRenderer class for safe Markdown parsing with XSS protection. Updated PostsRepository to fetch and resolve featured image data from the uploads table. Added UI controls in EditPost.php for selecting images and inserting inline Markdown. Updated views to display featured images on post cards and detail pages.
This commit is contained in:
@@ -31,6 +31,12 @@ $post = is_string($slug) && $slug !== ''
|
||||
<p class="text-lg leading-relaxed text-base-content/70"><?= phpb_e($post['excerpt']) ?></p>
|
||||
<?php endif; ?>
|
||||
</header>
|
||||
<div class="whitespace-pre-line text-base leading-7 text-base-content"><?= nl2br(phpb_e($post['body'])) ?></div>
|
||||
<?php if (!empty($post['featured_image_url'])): ?>
|
||||
<?php $featuredImageAlt = trim((string) ($post['featured_image_alt_text'] ?? '')) ?: $post['title']; ?>
|
||||
<figure class="overflow-hidden rounded-box">
|
||||
<img src="<?= phpb_e($post['featured_image_url']) ?>" alt="<?= phpb_e($featuredImageAlt) ?>" class="max-h-[32rem] w-full object-cover">
|
||||
</figure>
|
||||
<?php endif; ?>
|
||||
<div class="space-y-4 text-base leading-7 text-base-content"><?= (new \Plugi\Extensions\Blog\PostContentRenderer())->render($post['body']) ?></div>
|
||||
</article>
|
||||
<?php endif; ?>
|
||||
Reference in New Issue
Block a user