Skip to content

Markdown preview: local images never render (relative/absolute/file:// ignored; only http(s) and data: work) #71

Description

@Fartown

Otty version: 1.2.3 (macOS)
Component: built-in Markdown preview (file-open-with = "otty", .md → Markdown preview)

Summary

The Markdown preview renders text, tables and links correctly, but images referenced via local file paths never render — they show a broken-image placeholder. All local reference forms are affected:

  • relative: ![a](pic.jpg)
  • sub-directory: ![a](sub/pic.jpg)
  • absolute: ![a](/tmp/pic.jpg)
  • file URL: ![a](file:///tmp/pic.jpg)

http(s):// and data: URIs work fine.

Evidence (controlled experiments)

  1. atime probing — opened an .md containing the four local forms above; atimes of all referenced image files stayed untouched → the renderer never even attempts to read local image files.
  2. HTTP works — same document with image URLs rewritten to http://127.0.0.1:8899/... loads everything (server log: 83/83 GET 200).
  3. data: works — a document with 83 base64 data-URI images renders them (verified via decode CPU time).

Expected

Relative image paths resolve against the Markdown file's own directory and local images render (as in VS Code / Typora / GitHub), so repo docs like docs/guide.md + docs/assets/x.png preview correctly.

Actual

Only http(s) and data: images load; local file images are silently ignored.

Why it matters

Previewing repository documentation with bundled ./assets images is a common workflow; today the only workarounds are running a local HTTP server or embedding base64 — both awkward.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions