✨ Extend the ability of the hosted page markdown parser
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
using Markdig;
|
||||
using DysonNetwork.Shared.Models;
|
||||
using DysonNetwork.Shared.Proto;
|
||||
using DysonNetwork.Zone.Publication;
|
||||
// Add this using statement
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
|
||||
namespace DysonNetwork.Zone.Pages.Posts;
|
||||
|
||||
public class DetailsModel(PostService.PostServiceClient postClient) : PageModel
|
||||
public class DetailsModel(PostService.PostServiceClient postClient, MarkdownConverter markdownConverter) : PageModel
|
||||
{
|
||||
private readonly MarkdownConverter _markdownConverter = markdownConverter;
|
||||
[FromRoute] public string Slug { get; set; } = null!;
|
||||
|
||||
public SnPublicationSite? Site { get; set; }
|
||||
@@ -35,7 +36,7 @@ public class DetailsModel(PostService.PostServiceClient postClient) : PageModel
|
||||
|
||||
// Convert markdown content to HTML
|
||||
if (Post != null && !string.IsNullOrEmpty(Post.Content))
|
||||
Post.Content = Markdown.ToHtml(Post.Content);
|
||||
Post.Content = _markdownConverter.ToHtml(Post.Content);
|
||||
|
||||
return Page();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user