What it cleans up
Pasted chat text is tidied in these ways:
- Invisible characters and citation leftovers such as zero-width characters, private-use glyphs, and citation markers are removed.
- Math delimiters written as
\( \)and\[ \]become$and$$where the content is clearly math, so the math works in Markdown tools that support it. - Lists: bullet glyphs such as • become
-list items, and lists with a blank line between every item are tightened. - Code fences and tables: a code fence left open at the end is closed, and pipe tables missing their separator row get one.
- Whitespace: trailing spaces and extra blank lines are trimmed, and two-space line breaks are kept.
The cleanup steps skip fenced code blocks and inline code.