Skip to content

Absolute path for pasted images although local folder is configured #2510

Closed

Description

@hvoigt

Description

Pasted images are saved in relative paths but linked using absolute paths.

  • Can you reproduce the issue?

Steps to reproduce

  1. Verify you image settings:
    grafik
  2. Copy an image to the clipboard (e.g. screenshot).
  3. Paste into MarkText

Expected behavior:

The image is saved into the relative images folder and a relative path is used to embed the image.

Actual behavior:

The image is saved into the relative images folder and an absolute path is used to embed the image.

Versions

  • Mark Text version: 0.16.3
  • Operating system: Ubuntu 18.04.5

Activity

  1. northword commented on Feb 23, 2021

    @northword

    related to #2105.
    not only for pasted images, image from local file also is absolute path, i also need inserting to relative path.

  2. added
    🐛 bug
    🪲 pri/major
    on May 16, 2026
  3. Jocs commented on Jun 23, 2026

    @Jocs
    Member

    Thank you for this detailed report. The behavior you described — pasted images always getting an absolute path even when saving to a relative folder — has since been addressed.

    A "Prefer relative directory" toggle was added to Preferences → Image (under the Folder Setting section). When enabled, MarkText resolves the saved path relative to the current file and writes a portable relative reference (e.g. images/screenshot.png) into the markdown instead of an absolute path. The logic for binary clipboard pastes specifically is in the imageAction handler (editor.vue) and routes through moveImageToFolder with isRelative=true when that preference is on. A follow-up fix in #4492 also closed a gap where inserting via a local file path string skipped the relative conversion.

    To use relative paths today: open Preferences → Image, ensure "Default behavior" is set to "Move image to folder", then enable the "Prefer relative directory" checkbox and configure the relative folder name (default: assets). The file must be saved to disk for the relative reference to be computed.

    Closing as implemented. Please reopen if you find a remaining case where the preference is on but an absolute path is still written.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    🪲 pri/major🐛 bug🔭 area/editor

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions