In Blazor, you can treat a string as HTML by using MarkupString, or Html.Raw in non Blazor apps. sbox doesnt have either instead use a RenderFragment delegate.
@inherits PanelComponent
@namespace Sandbox
<style>
.code-block {
margin: 50px;
font-family: monospace;
font-size: 64px;
white-space: pre;
flex-direction: column;
display: flex
}
</style>
<root>
<div class="code-block">
@Content
</div>
</root>
@code
{
public RenderFragment Content { get; set; }
[Property] public string RawCodeBlock { get; set; } // HTML is string form
protected override void OnStart()
{
Content += builder =>
{
builder.AddMarkupContent( 0, RawCodeBlock );
};
}
protected override int BuildHash() => System.HashCode.Combine( RawCodeBlock );
}