servicestackservicestack-razor

Markdown for single value inside Razor


Is there any quick way to render a value as Markdown within a ServiceStack Razor page?

E.g. @MyText.ToMarkdown() or something?


Solution

  • Yes, you can use:

    @Html.RenderMarkdownToHtml("## Heading2")
    

    Or you could transform the markdown to HTML manually and embed the raw HTML with:

    @(new MarkdownSharp.Markdown().Transform("## Heading2").AsRaw())