Render markdown on hosted pages

This commit is contained in:
2025-11-22 13:28:37 +08:00
parent bd1715c9a3
commit c806365a81
4 changed files with 105 additions and 84 deletions

View File

@@ -1,3 +1,4 @@
using Markdig;
using DysonNetwork.Shared.Models;
using DysonNetwork.Shared.Proto;
using DysonNetwork.Zone.Publication;
@@ -31,6 +32,10 @@ public class DetailsModel(PostService.PostServiceClient postClient) : PageModel
}
Post = SnPost.FromProtoValue(response);
// Convert markdown content to HTML
if (Post != null && !string.IsNullOrEmpty(Post.Content))
Post.Content = Markdown.ToHtml(Post.Content);
return Page();
}