Exemple #1
0
        public static void Main(string[] args)
        {
            // Get executing path and /example.md full path
            string exeLocation = Assembly.GetExecutingAssembly().Location;
            string path = Path.GetDirectoryName( exeLocation );
            string template = Path.Combine(path, "example.md");

            // Create the markdown-razor template compiler
            MarkdownFormat format = new MarkdownFormat();
            string contents = File.ReadAllText(template);
            var page = new MarkdownPage(format, path, "example", contents );
            format.AddPage(page);

            // Create our view container (ViewBag)
            var view = new Dictionary<string, object>()
            {
                { "examples", examples }
            };

            // Compile and output.
            // This can be redirected to html file
            // e.g. RazorExample.exe > output.html
            var html = format.RenderDynamicPageHtml("example", view);
            Console.WriteLine(html);
        }