public static MarkdownDocument ToLatex(string markdown, TextWriter writer, MarkdownPipeline pipeline = null) { if (markdown == null) { throw new ArgumentNullException(nameof(markdown)); } if (writer == null) { throw new ArgumentNullException(nameof(writer)); } pipeline = pipeline ?? new MarkdownPipelineBuilder().Build(); pipeline = CheckForSelfPipeline(pipeline, markdown); // We override the renderer with our own writer var renderer = new LatexRenderer(writer); pipeline.Setup(renderer); var document = Parse(markdown, pipeline); renderer.Render(document); writer.Flush(); return(document); }