MarkdownReportRenderer

A ReportVisitor that renders a ReportNode tree to GitHub-flavoured Markdown.

Delegates all statistical table formatting to StatisticReporter (reusing the existing half-width and summary report methods). Uses MarkDown.Table for ReportNode.DataTable and ReportNode.WeightedStatTable nodes.

Section depth tracking: ReportNode.Section nodes increment an internal depth counter on enter and decrement on exit. Heading levels are promoted automatically:

  • Document title → #

  • Depth 1 sections → ##

  • Depth 2 sections → ###

  • Depth 3+ sections → #### (capped at ######)

Node rendering:

All mutable state uses the my prefix per KSL coding conventions.

@param ctx the render context supplying output paths and formatting preferences

Constructors

Link copied to clipboard
constructor(ctx: RenderContext = RenderContext())

Functions

Link copied to clipboard
open override fun enterDocument(node: ReportNode.Document)
Link copied to clipboard
open override fun enterSection(node: ReportNode.Section)
Link copied to clipboard
open override fun exitDocument(node: ReportNode.Document)
Link copied to clipboard
open override fun exitSection(node: ReportNode.Section)
Link copied to clipboard
fun output(): String

Returns the accumulated report as a Markdown String.

Link copied to clipboard
fun result(): String

Returns the accumulated Markdown report as a String.

Link copied to clipboard
open override fun visit(node: ReportNode.DataTable)
open override fun visit(node: ReportNode.Heading)
open override fun visit(node: ReportNode.PageBreak)
open override fun visit(node: ReportNode.Paragraph)
open override fun visit(node: ReportNode.PlotNode)
open override fun visit(node: ReportNode.RawText)
open override fun visit(node: ReportNode.StatPropertyTable)
open override fun visit(node: ReportNode.StatTable)
open override fun visit(node: ReportNode.WeightedStatTable)
Link copied to clipboard

Writes the accumulated report to the given PrintWriter.

fun writeTo(path: Path): File

Writes the accumulated report to a file at path and returns a File reference.