# Import Fixer Cleans up notes imported into Obsidian from web clippers (Evernote, etc.). Targets the common artifacts: - Header favicons that render at 200+ px and dominate the note - Reddit/Twitter/Zhihu UI icons (avatars, community badges, tracking pixels) scattered through the body - Embedded `![[]]` icons stuffed inside the link text of `[…](url)` references - `_resources/.resources/` folders left behind by Evernote import - Broken `![[…/X.resources/file.ext]]` links pointing at folders that have since been renamed ## sample document image image ## Commands | Command | What it does | |---|---| | **Auto-fix current note (all fixes)** | Runs *Repair broken resource links* then *Shrink small UI icons* in one shot. | | **Repair broken resource links in current note** | For each `![[…/X.resources/file.ext]]` link where `X.resources` no longer exists, scans every `res_*.resources` folder, finds the one containing the most of the missing files, and rewrites the link to point there. | | **Shrink small UI icons in current note** | Adds `\|48` to wiki-link image embeds whose filename matches known icon patterns (favicons, avatars, Reddit `communityIcon_*`, Zhihu `embedded.svg`, web-1.0 `spacer.gif`, etc.). Random-hash content image filenames don't match and stay untouched. | | **Strip embedded icons** | On the current selection, removes `![[…]]` image embeds nested inside `[…](url)` link text — leaves the link alone. | ## Icon patterns recognised by Shrink Favicons: `touch.*`, `apple-touch-icon*`, `favicon*`, `logo[.-_]*` Generic prefixes: `ico_*`, `ico-*`, `icon_*`, `emoji_*` Avatars: `avatar*`, `default-avatar*`, `default_profile*`, `profile_image*`, `gravatar*`, `octocat*` Reddit: `communityIcon*`, `image_widget_*`, `svg_.svg`, `renderTimingPixel*` Zhihu / Twitter / SO: `embedded.svg`, `zhihu-*`, `verified*`, `flair*` Spacers: `spacer.*`, `pixel.*`, `1x1.*`, `clear.*`, `transparent.*`, `blank.*`, `placeholder.*` Loaders: `loading*`, `loader*`, `spinner*` UI words: `arrow|chevron|bullet|dot|bg|bar|line|left|right|up|down|prev|next|star|check|cross|tick|caret|plus|minus|close|center|top|bottom|divider|separator|corner|border|frame|tab|header|footer` followed by an optional suffix and extension. ## Repair-links algorithm 1. Index every file inside every `res_*.resources` folder under `/_resources/`. 2. Walk every `![[…/X.resources/file.ext]]` link in the note. 3. For broken folder references (where `X.resources` doesn't exist), tally which existing folders contain the referenced filenames. 4. The folder with the most matches wins; rewrite each broken link to point at it. This handles the case where a previous import-cleanup run renamed folders but crashed before saving updated links. ## Install (manual) 1. Download `main.js` and `manifest.json` from the latest [Release](https://github.com/tonylee2016/obsidian-import-fixer/releases). 2. Drop them into `/.obsidian/plugins/import-fixer/`. 3. Enable **Import Fixer** in Settings → Community plugins. ## Build There is no build step — `main.js` is plain JavaScript using Obsidian's runtime API directly. ## Notes - Tested on macOS desktop with an iCloud-synced vault. Mobile is untested; the manifest currently sets `isDesktopOnly: false`, but if you run on mobile please report any issues. - The repair command is destructive (it rewrites note content). Back up your vault or work on a copy the first time you run it. - Console logs are gated behind `DEBUG = false` at the top of `main.js`. Flip to `true` to see per-link decisions in the dev console. ## License MIT — see [LICENSE](LICENSE).