C#C
C#2y ago
gax

Rendering a razor component from a raw string

I'm trying to render a <Equation/> from MathJaxBlazor in a raw string using MarkupString but it doesn't render the component, or anything but the raw HTML really. Anyone have any ideas on how to solve this or how I could render it in another way?

Here's the source code for the page:

@page "/"
@using MathJaxBlazor

<h1>Hello, world!</h1>

@((MarkupString)content)

@code {
    private string content =
""""
<h2> Hi ! </h2>
<p> This is a test </p>
<MathJaxBlazor.Equation Value="a^2 + b^2 = c^2" />
"""";
}


When running the code, the page looks like the image shows
image.png
Was this page helpful?