protected override void Write(RenderFragmentMarkdownRenderer renderer, QuoteBlock obj) { renderer.WriteElementStart("blockquote") .WriteAttributes(obj.TryGetAttributes()); var oldImplicitParagraph = renderer.ImplicitParagraph; renderer.ImplicitParagraph = false; renderer.WriteChildren(obj); renderer.ImplicitParagraph = oldImplicitParagraph; renderer.WriteElementEnd(); }
protected override void Write(RenderFragmentMarkdownRenderer renderer, ListBlock obj) { renderer.WriteElementStart(obj.IsOrdered ? "ol" : "ul") .WriteAttributes(obj.TryGetAttributes()); foreach (ListItemBlock item in obj) { var oldImplicitParagraph = renderer.ImplicitParagraph; renderer.ImplicitParagraph = !obj.IsLoose; renderer.WriteElementStart("li").WriteAttributes(item.TryGetAttributes()); renderer.WriteChildren(item); renderer.WriteElementEnd(); renderer.ImplicitParagraph = oldImplicitParagraph; } }
protected override void Write(RenderFragmentMarkdownRenderer renderer, LinkInline obj) { string url = obj.GetDynamicUrl?.Invoke() ?? obj.Url; renderer.WriteElementStart(obj.IsImage ? "img" : "a") .WriteAttribute(obj.IsImage ? "src" : "href", url); if (obj.IsImage) { renderer.WriteAttribute("alt", "** Image **"); // Don't wanna bother implementing this yet. It would require creating a nested HTML renderer + StringWriter. } if (!string.IsNullOrEmpty(obj.Title)) { renderer.WriteAttribute("title", obj.Title); } if (!obj.IsImage) { renderer.WriteChildren(obj); } renderer.WriteElementEnd(); }