Ejemplo n.º 1
0
        public static string ToHtml(string markdown)
        {
            var markdownPipelineBuilder = new MarkdownPipelineBuilder()
                                          .DisableHtml()
                                          .UseAutoLinks();

            markdownPipelineBuilder
            .Extensions
            .AddIfNotAlready <UnescapedFencedCodeBlockExtension>();

            var pipeline = markdownPipelineBuilder.Build();

            return(MarkdownHelper.ToHtml(markdown ?? string.Empty, pipeline));
        }
Ejemplo n.º 2
0
        public void Render(string source, out string html, out string tree)
        {
            using (var sw = new StringWriter())
            {
                var doc = Markdown.ToHtml(source, sw, Pipeline);
                html = sw.ToString();
                var node = new HeadingNode();

                foreach (var item in doc)
                {
                    if (item is HeadingBlock hb)
                    {
                        node.Insert(new HeadingNode
                        {
                            Id    = hb.GetAttributes().Id,
                            Level = hb.Level,
                            Title = hb.Inline?.FirstChild.ToString()
                        });
                    }
                }

                tree = node.ToString();
            }
        }
Ejemplo n.º 3
0
 public string Render(string source)
 {
     return(Markdown.ToHtml(source, Pipeline));
 }
Ejemplo n.º 4
0
 public string ToHtml(string text)
 {
     return(Markdigger.ToHtml(text, pipeline));
 }