I have some HTML that is stored in a string. How can I render it in a Blazor/Razor view without automatic HTML encoding?
Feature to render raw HTML was added in Blazor
0.5.0 version. This is the example of how raw HTML can be rendered from string
containing HTML content:
@((MarkupString)myMarkup)
@functions {
string myMarkup = "<p class='markup'>This is a <em>markup string</em>.</p>";
}
More info can be found in "Blazor 0.5.0 experimental release now available" announcement.