Before and after repair

Agents do not write well-formed Markdown: emphasis left open, a fence the output ran out before closing, a backtick with no partner. mdwire repairs these before rendering for the channel. Here the input sits next to what mdwire sends — added and removed characters are marked — and the repair report below counts each kind of fix.

Each example is a case from the corpus where a repair actually happens. Edit the input to break it your own way.

Loading the WASM build…

The repair report says how often the model broke its own formatting. Logged per answer, it shows how much an agent leans on the normalizer — the CLI’s --batch jsonl does the same over hundreds of answers. The first four counters are repairs; the other six count what the channel needed rewritten — on table-cell-overflow the table is rewritten as well, except on Notion, which gets a <table> (concepts).

This demo’s code
import { renderWithReport } from "@minjun0219/mdwire";

const out = renderWithReport(input, "slack-markdown");
const r = out.repairs;
out.parts.join(""); // what you send
r.closedEmphasis;   // emphasis closed at the end of its block
r.closedFence;      // fence closed at the end of the document
r.revertedCodeSpan; // backtick run with no partner, kept as text
r.droppedMarker;    // stray ** dropped
r.rewrittenTable;   // … and six counts of what the channel needed rewritten
r.free();           // both live in WASM memory — free them when done
out.free();

The marks come from a character-level diff of the input against the output, done in the page — mdwire reports counts, not positions. Full component: site/src/components/RepairCompare.tsx.