Fix Images Command
Automatically wraps standalone images in <Frame> components in MDX documentation files.
Usage
writechoice fix images [options]
Options
| Option | Alias | Description | Default |
|---|---|---|---|
--file <path> | -f | Fix a single MDX file | - |
--dir <path> | -d | Fix MDX files in a specific directory | - |
--download [url] | - | Download missing local images (uses source from config or a URL) | - |
--dry-run | - | Preview changes without writing files | false |
--quiet | - | Suppress terminal output | false |
What Gets Wrapped
Markdown images on their own line:

HTML <img> tags on their own line:
<img src="https://example.com/image.png" alt="Alt text" />
Both become:
<Frame>

</Frame>
What Is Skipped
| Protected region | Example |
|---|---|
Existing <Frame> blocks | <Frame></Frame> |
| Fenced code blocks | ``` ... ``` |
| Markdown tables | |  | data | |
| HTML tables | <table><tr><td><img /></td></table> |
Images that are part of inline text (not alone on a line) are also left unchanged — use Fix Inline Images for those.
Examples
# Preview changes before writing
writechoice fix images --dry-run
# Fix all MDX files in the current directory
writechoice fix images
# Fix a specific directory
writechoice fix images -d docs/api
# Download missing images using source from config.json
writechoice fix images --download
# Download missing images from a specific URL
writechoice fix images --download https://docs.example.com
Downloading Missing Images
When --download is used:
- Root-relative paths (e.g.
/images/logo.png) are downloaded from the provided or configured base URL - External URLs are skipped
- Files already on disk are not re-downloaded
- Failures are written to
image_download.json
Config File
{
"images": {
"dir": "docs",
"download": false,
"dry-run": false,
"quiet": false
}
}
Safety
- Never removes or modifies image attributes
- Images already in
<Frame>are never touched - Idempotent: running twice produces the same result
- Use
--dry-runbefore writing - Revert with
git checkout .if needed