Before and after repair

Agent-written Markdown may not render correctly through a standard Markdown converter: emphasis left open, a code fence left open when the output ran out, 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 one of the test cases 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 counted as rewritten too, 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.