The Roc diagnostic system uses a single document model (DocumentElement and Annotation) to represent errors and warnings. This model is rendered into four distinct targets via the RenderTarget abstraction in src/reporting/renderer.zig.
Supported renderers include:
- Terminal: Uses ANSI codes and
ColorPalette for colorization. - Markdown: Uses backticks for annotations.
- HTML: Uses CSS classes based on
Annotation.semanticName. - LSP: Formats diagnostics for Language Server Protocol consumers.
While the traversal logic (element order, wrapping, and region math) is intended to be shared, target-specific differences exist in how annotations are opened/closed, how structure is escaped, and how source regions are drawn.