Skclusive.Script.Prism

PrismJs Blazor integration

MIT License

Stars
3

Skclusive.Script.Prism

Code Highliter component library for Blazor. Integrating PrismJs.

Installation

Add a reference to the library from

Usage

Add the following in _Imports.razor:

@using Skclusive.Script.Prism

Make the registration in Startup.cs

public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddPrism();
    }

    public void Configure(IComponentsApplicationBuilder app)
    {
        app.AddComponent<App>("app");
    }
}

Add the resources in App.razor

<PrismStyles />
<PrismScript />

<Router AppAssembly="@typeof(Program).Assembly">
    ....
</Router>

you can use the PrismCode component to render code block as blow

<PrismCode
  Code="@(@"<body>
    <div style=""padding: 20px;"">
      <Grid Container Spacing=""@Spacing.Five"">
        //...
      </Grid>
    </div>
  </body>")"
/>

Following is the rendered output in dark theme.

License

Skclusive.Script.Prism is licensed under MIT license