Skip to main content

Localize remote image references in Markdown and Obsidian notes.

Project description

md-localize-images

md-localize-images scans Markdown files, downloads remote image references, stores them locally, and rewrites the image links.

The tool is intended for Obsidian vaults, but it also works with ordinary Markdown files. The default rewritten link style is Obsidian embed syntax:

![[attachments/image.png]]

Install for development

python -m pip install -e ".[dev]"

Usage

Process one file:

md-localize-images --file path/to/note.md

Process a vault recursively:

md-localize-images --vault path/to/vault --recursive

Choose where downloaded images are stored:

md-localize-images --file note.md --images-dir attachments/imported-images

Use relative Markdown links instead of Obsidian links:

md-localize-images --file note.md --link-style relative

Run without writing files:

md-localize-images --vault . --recursive --dry-run

Create Markdown backups before modification:

md-localize-images --vault . --recursive --backup

Process raw HTML image tags as well as Markdown images:

md-localize-images --vault . --recursive --include-html-img

Exit Codes

  • 0: success
  • 1: one or more downloads failed, but processing completed
  • 2: invalid command-line arguments
  • 3: filesystem or path configuration error

Notes

  • WebP images are saved as PNG files.
  • Links inside fenced code blocks, indented code blocks, inline code spans, and HTML comments are not modified.
  • Existing image files are not overwritten; a deterministic hash is added to avoid collisions.
  • Repeated identical URLs are downloaded once per invocation.
  • Phase one does not include a persistent cache.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

md_localize_images-0.1.0.tar.gz (21.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

md_localize_images-0.1.0-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

Details for the file md_localize_images-0.1.0.tar.gz.

File metadata

  • Download URL: md_localize_images-0.1.0.tar.gz
  • Upload date:
  • Size: 21.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for md_localize_images-0.1.0.tar.gz
Algorithm Hash digest
SHA256 eb7f9df60196cb5f90067ae7e89d731146dd89d9b178390411e4b118ed91ce15
MD5 74c37a3a00a3d46e42f46ab18d1d3abb
BLAKE2b-256 70d71e948ca143a7d1f249967d8d746b71fc592bfaaf28ca02871013842efb7e

See more details on using hashes here.

File details

Details for the file md_localize_images-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for md_localize_images-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 447cc6af9043b72b2b6b7803a90714168886a9b6335f6534ca04749aaf403065
MD5 d628f69d9c665ec74e872880bfea438e
BLAKE2b-256 47baaaf35b6281687109d1ba4eb2999d7d69dc3ceaf9b85ff02250d39cb55d62

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page