Static markdown

Hi, I might be being dumb here, but I can’t get this to work.

Want to serve a static markdown page for release notes, and have included the following in Global.asax.cs

Plugins.Add(new MarkdownFormat());

And have created a default.shtml (is this still the right way?)
And created a ReleaseNotesRequest.md - following the “same name as DTO convention”.

I have then created the following Service method

 public object Get(ReleaseNotesRequest request)
    {
        var response = new HttpResult();
        response.View = "ReleaseNotesRequest";
       return response;
    }

But the markdown is not being rendered, just the out of the box SS html. I must be doing something basic wrong, but am lost. Any ideas?

G

Have a look at the source code for the Docs Example Project to see an example site built with Markdown Razor.

It also includes docs on Markdown Razor and how it merges with a static default.shtml template and describes how it selects which /Views/MarkdownPage.md to choose based on the Request or Response DTO name.

A more flexible alternative may be to use it together with Razor by embedding a Markdown View inside a Razor page like how Razor Rockstars website is built, e.g. have a look at the bottom of the Eddie Vedder Page to see how it’s built by rendering a /Vedder/Content.md Markdown view with:

@Html.Partial("Content")

You can also render markdown in Razor pages directly with:

@Html.RenderMarkdownToHtml("## Heading2")

Thanks.

I got this working, part of the problem was that I was using compiled razor views, and .md views aren’t included in this. Once I set the md file to “Copy if newer”, it was embedded in the cshtml as expected. Thanks for help.

1 Like