Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,30 @@ public partial class BitMarkdownViewer : BitComponentBase

protected override async Task OnInitializedAsync()
{
_html = await _markdownService.Parse(Markdown, _cts.Token);

StateHasChanged();
await ParseAndRender();

await base.OnInitializedAsync();
}



private async Task OnMarkdownSet()
private void OnMarkdownSet()
{
if (IsRendered is false) return;

await ParseAndRender();
_ = ParseAndRender();
}

private async Task ParseAndRender()
{
_html = await _markdownService.Parse(Markdown, _cts.Token);
try
{
_html = await _markdownService.Parse(Markdown, _cts.Token);
}
catch
{
_html = "<b>The BitMarkdownViewer failed to parse the markdown!</b>";
}

StateHasChanged();
}
Expand Down
Loading