/** * Markdown to the HTML a word processor will take. * * ## Why this exists at all * * The transcript on screen is *rendered* markdown: a table is box-drawing * characters, a code block is a bordered panel, a heading is a coloured chip, a * long line is hard-wrapped to the terminal's width. Selecting that with the * mouse and pasting it into Word or Confluence pastes exactly what it looks * like — dotted rules, broken table edges, wrapping frozen at eighty columns — * because the terminal's clipboard carries glyphs and nothing else. * * What the user wanted to copy is the *structure*, and the structure is still * in the markdown the model wrote. So the copy path goes back to that source * and offers it twice: the markdown itself as plain text, and this, as HTML, * for anything that knows how to take a rich paste. Word turns `

` into a * heading and `` into a table; Confluence does the same; a plain text * field gets the markdown and is none the wiser. * * ## What it is not * * Not a markdown implementation. It is the subset an agent transcript actually * contains — headings, emphasis, code, links, lists, quotes, rules and GFM * tables — rendered as the plainest HTML that survives a paste. Anything it * does not recognise comes through as text, which is the failure a reader can * still work with. There is no HTML passthrough: source markdown is untrusted * input as far as this is concerned, every `<` is escaped, and a model that * wrote `