@inject HttpClient httpClient
@if (content == null)
{
}
else
{
@((MarkupString)Markdown.ToHtml(content, Pipeline))
}
@code {
[Parameter] public NoteContentModel NoteContentModel { get; set; } = default!;
NoteFrontMatterModel noteFrontMatter = null!;
private string? content;
private string Filepath => $"content/notes/{NoteContentModel.Content}.md";
private string GitUrl => $"{Project.GitResourcesUrl}/{Filepath}";
private MarkdownPipeline Pipeline => MarkdownFiles.Pipeline;
private async Task LoadContent()
{
content = await MarkdownFiles.LoadMarkdown(httpClient, Filepath);
return noteFrontMatter =
await MarkdownFiles.LoadFrontMatter(httpClient, Filepath);
}
protected override async Task OnParametersSetAsync()
{
await LoadContent();
}
protected override async Task OnInitializedAsync()
{
await LoadContent();
}
}