forked from ServiceStack/ServiceStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMarkdownFormatExtensions.cs
More file actions
23 lines (21 loc) · 912 Bytes
/
MarkdownFormatExtensions.cs
File metadata and controls
23 lines (21 loc) · 912 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
using ServiceStack.VirtualPath;
using ServiceStack.WebHost.Endpoints.Formats;
using ServiceStack.WebHost.Endpoints.Support.Markdown;
namespace ServiceStack.ServiceHost.Tests.Formats
{
public static class MarkdownFormatExtensions
{
public static void AddFileAndPage(this MarkdownFormat markdown, MarkdownPage markdownPage)
{
var pathProvider = (InMemoryVirtualPathProvider)markdown.VirtualPathProvider;
pathProvider.AddFile(markdownPage.FilePath, markdownPage.Contents);
markdown.AddPage(markdownPage);
}
public static void AddFileAndTemplate(this MarkdownFormat markdown, string filePath, string contents)
{
var pathProvider = (InMemoryVirtualPathProvider)markdown.VirtualPathProvider;
pathProvider.AddFile(filePath, contents);
markdown.AddTemplate(filePath, contents);
}
}
}