# On-Demand Cache On-demand persistent cache for remote attachments (images, videos, audio, documents). Downloads files only when you open a note, then transparently serves the local copy instead of the network file while keeping your original links unchanged. [δΈ­ζ–‡ζ–‡ζ‘£ / Chinese documentation](README.zh-CN.md) ## Features - **πŸ“΄ Offline reading of remote links**: Once an attachment has been cached, you can read the note **completely offline** β€” images, videos, audio, and documents load from the local cache with no network connection required. Remote links in your notes keep working even in airplane mode or on a flaky connection. - **πŸ”— Original links stay intact**: Notes are never rewritten. The `https://...` URLs remain exactly as you wrote them; the plugin only swaps in the local file at render time. - **⚑ On-demand download**: Attachments are fetched only when you open a note β€” no bulk pre-downloading, no wasted bandwidth. - **πŸ’Ύ Persistent local cache**: Cached files live in the `.cache` folder and stay there, so reopening a note is instant and works offline. - **πŸ” Content-hash deduplication**: Identical files are stored only once, saving disk space. - **πŸ“± Auto-fill across devices**: Open a note on another device and any missing attachments are downloaded automatically. - **🎨 Bilingual UI**: English and Chinese, switching automatically with Obsidian's language. ## How it works - **Original links preserved**: Network links (`https://...`) in your notes stay untouched. Syncing only syncs the link text, never the actual files. - **On-demand download**: Attachments are downloaded only when you open a note, not proactively in bulk. - **Persistent local cache**: Files are stored in the `.cache` folder (excluded from syncing, so they are never synced). - **Serve local copy**: When reading/previewing, remote links are transparently replaced with local cache paths for offline access. - **Auto-fill on other devices**: When you open a note on another device, missing attachments are downloaded automatically. ## Difference from "download & replace" plugins Most similar plugins **permanently rewrite** the links in your notes (changing `https://...` to a local path). This plugin **never modifies your note content** β€” it only temporarily uses local files at render time, keeping the original network links intact. As a result: - Notes sync safely across devices (only link text is synced, not large files). - Missing attachments are re-cached on demand after switching devices. - You can always fall back to network loading with no side effects. ## Implementation ### Key processing steps 1. **Link extraction**: When a note is opened, all network links are extracted from the Markdown content using regex, supporting Markdown images `![alt](url)`, Markdown links `[text](url)`, HTML tags ``/`