-
Notifications
You must be signed in to change notification settings - Fork 0
/
MarkProxy.cs
36 lines (33 loc) · 954 Bytes
/
MarkProxy.cs
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
32
33
34
35
36
using Microsoft.DocAsCode.Build.Engine;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.DocAsCode.Plugins;
using Newtonsoft.Json.Linq;
namespace MarkdownVariation
{
public sealed class MarkProxy : MarshalByRefObject
{
private static readonly IMarkdownService _markdown;
static MarkProxy()
{
var provider = new DfmJsonTokenTreeServiceProvider();
_markdown = provider.CreateMarkdownService(new MarkdownServiceParameters { });
}
public string Parse(string markdown)
{
try
{
return _markdown.Markup(markdown, "c:\\").Html;
}
catch (Exception ex)
{
var result = new JObject();
result["error"] = ex.Message;
return result.ToString();
}
}
}
}