Skip to content

Resolve relative image paths to file:// URLs in rendered HTML - #76

Merged
masawada merged 4 commits into
mainfrom
resolve-image-paths
Sep 4, 2026
Merged

masawada merged 4 commits into
mainfrom
resolve-image-paths

Conversation

@masawada

@masawada masawada commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Why

Generated HTML lives under ~/.mdp/, so relative image references like ![diagram](images/a.png) point at a path that does not exist there and show up broken in the browser.

What

  • Rewrite the src of every <img> in the rendered HTML to a file:// URL resolved against the markdown file's directory. Values that already have a scheme (https://, data:, etc.) are left as is.
  • The rewrite runs on the rendered HTML before the theme template is applied, so it covers both markdown images and raw <img> tags (unsafe: true) without touching the theme.
  • Add an e2e case and a README section.

@masawada
masawada merged commit eb2b556 into main Sep 4, 2026
5 checks passed
@masawada
masawada deleted the resolve-image-paths branch September 4, 2026 05:25
@github-actions github-actions Bot mentioned this pull request Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant