@using Ganss.Xss
@using Markdig
@using Markdig.Extensions.AutoIdentifiers
@using Pek.Markdig.HighlightJs
@model string

@{
    var pipelineBuilder = new MarkdownPipelineBuilder()
        .UseSmartyPants()
        .UseEmojiAndSmiley()
        .UseAlertBlocks()
        .UseAdvancedExtensions();

    pipelineBuilder.Extensions.Remove(pipelineBuilder.Extensions.Find<AutoIdentifierExtension>()!);
    pipelineBuilder.UseAutoIdentifiers(AutoIdentifierOptions.GitHub);
    pipelineBuilder.UseHighlightJs();
    var sanitizer = new HtmlSanitizer();
    sanitizer.AllowedAttributes.Add("class");
    sanitizer.AllowedAttributes.Add("id");
    var pipeline = pipelineBuilder.Build();
}

@Html.Raw(sanitizer.Sanitize(Markdown.ToHtml(Model, pipeline)))