Custom rendering for syntax highlighting or structured output (e.g., HTML).
Use Pretty.pretty for plain text. Use this module when you need to handle
tagged strings differently or produce non-string output.
Pretty prints with both page width and ribbon width constraints.
The ribbon width limits non-indentation characters per line. At indentation
level i, the effective width is min(pageWidth, i + ribbonWidth).
Accumulator-based renderer, similar to foldl.
init: Starting accumulator valuetagged: Handle tagged text (for syntax highlighting)untagged: Handle untagged text and indentationnewline: Handle line breaks (add \n here if needed)outer: Transform final accumulator to output typeText is processed left-to-right; reverse lists if accumulating in order.
htmlRenderer : Renderer Tag (List (Html msg)) (Html msg)
htmlRenderer =
{ init = []
, tagged = \tag text acc -> styledSpan tag text :: acc
, untagged = \text acc -> Html.text text :: acc
, newline = \acc -> Html.br [] [] :: acc
, outer = \acc -> Html.pre [] (List.reverse acc)
}
Renders a document using a custom
Renderer.