-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMarkdown.cs
More file actions
31 lines (28 loc) · 780 Bytes
/
Markdown.cs
File metadata and controls
31 lines (28 loc) · 780 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using System.IO;
using Cake.Common.IO;
using Cake.Core;
using Cake.Core.IO;
using Markdig;
namespace Dnn.CakeUtils
{
public static class Markdown
{
public static string ToHtml(this ICakeContext context, FilePath fileName)
{
if (context.FileExists(fileName))
{
var input = "";
var pipeline = new MarkdownPipelineBuilder().UseAdvancedExtensions().Build();
using (var sr = new StreamReader(context.MakeAbsolute(fileName).FullPath))
{
input = sr.ReadToEnd();
}
return Markdig.Markdown.ToHtml(input, pipeline);
}
else
{
return "";
}
}
}
}