Markdown Stupefy: Tidy AI Text in VS Code

The extension name was inspired by the “stupefy mode” described in the SmartyPants project written by John Gruber, the creator of Markdown.
The extension name was inspired by the “stupefy mode” described in the SmartyPants project written by John Gruber, the creator of Markdown.

If you copy AI responses into Markdown, you will often get curly quotes, em dashes, emojis, and other smart punctuation. They look fine, but they are Unicode characters that can trip linters and clutter diffs. So I built a tiny tool to fix that.

Automate tidying AI text

Markdown Stupefy is a VS Code extension that normalizes smart punctuation to plain ASCII, removes emojis, and cleans up trailing whitespace. Here is a GIF demo:

A demo showing the extension cleaning up AI-generated text. Typeface: TheSansMono by Lucas de Groot. Recorded with VS Code Chronicler. GIF produced with ffmpeg and gifski.
A demo showing the extension cleaning up AI-generated text. Typeface: TheSansMono by Lucas de Groot. Recorded with VS Code Chronicler. GIF produced with ffmpeg and gifski.

The extension currently includes three commands:

  1. Convert smart punctuation to ASCII.
  2. Remove all emoji characters. 🙄🙅⛔
  3. Trim trailing whitespace and ensure a single final newline.

Get the extension

You can install the extension from the VS Code Extensions view (search “stupefy”) or click “Install” on the Marketplace page. After installation, open the Command Palette (Ctrl+Shift+P or Command+Shift+P on Mac), type “stupefy”, and run a command.

The extension is written in TypeScript (with help from Claude Code) and hosted on GitHub. Feedback and contributions are welcome.

The single most important setting in VS Code

For plaintext workflows, what you see should be what is actually there. Visual disguises from typographic Unicode can hide problems. For that reason, I recommend enabling Unicode highlighting in VS Code so non-ASCII stands out, especially if AI is in your workflow.

You can enable it via Code > Settings… > Settings, then search “Unicode Highlight”. I set the “Non Basic ASCII” option to true so VS Code always highlights non-basic ASCII characters in both untrusted workspaces and trusted workspaces. By default, they are only highlighted in untrusted workspaces.

Alternatively, open the Command Palette and choose “Preferences: Open User Settings (JSON)”, then add this key-value pair to settings.json:

"editor.unicodeHighlight.nonBasicASCII": true

Release notes for VS Code v1.63 (November 2021) and v1.64 (January 2022) covered the evolution of this feature.

Beyond the native setting, extensions like Gremlins tracker for Visual Studio Code can also help visualize tricky invisible characters such as non-breaking spaces and zero-width spaces.