-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathProgram.cs
38 lines (31 loc) · 896 Bytes
/
Program.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
37
38
using System;
using System.IO;
using CommonMark;
namespace CommonMarkNETSample
{
class MainClass
{
public static void Main(string[] args)
{
// String
var file = File.ReadAllText("input.md");
var exp = CommonMark.CommonMarkConverter.Convert(file);
Console.WriteLine(exp);
// Stream
using (var reader = new StreamReader("input.md"))
using (var writer = new StreamWriter("output.html"))
{
CommonMark.CommonMarkConverter.Convert(reader, writer);
}
// Personalizando el resultado
using (var reader = new StreamReader("input.md"))
using (var writer = new StreamWriter("output1.html"))
{
var settings = CommonMarkSettings.Default.Clone();
settings.OutputDelegate += (doc, output, sett) =>
new CustomHtmlFormatter(output, sett).WriteDocument(doc);
CommonMark.CommonMarkConverter.Convert(reader, writer, settings);
}
}
}
}