MacDownApp / MacDownApp/macdown

"Base URL" for resolving inline image relative references

Open
#878 4 comments 3 reactions 0 assignees View on GitHub
enhancement
Dominant language
Rich Text Format
Stars
9.8k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

I've got a bunch of Wiki pages on GitLab which include images. Images on their system are referenced using paths **_relative to the wiki root_**, without any protocol/host name. E.g.:

```md
![image](/uploads/78907xyzzy23423/image.png)
```
This is fine, and works great. (I can paste the images right into the editor!) BUT, when I check out the wiki git repo and load it into _Macdown_ I get a **_broken image_**.

![image](https://user-images.githubusercontent.com/1170666/32109973-50c3ee2c-bb04-11e7-9393-939ebc6a5f99.png)

To fix it, I have to edit the image reference to include the host path before the image path:

```md
![image](https://gitlab.com/erlbaum_group/foo/bar/uploads/78907xyzzy23423/image.png)
```

Here's my request: **_Is it possible to have a document-specific Base URL for images?_**

I'm not sure how this would best be implemented, but I'm thinking maybe some hidden pragma in the document? Such as:

```md
[macdown_base_image_url]: # (https://foo.bar.bat/path/to/base/)
```
FYI, The idea for that syntax comes from:

https://stackoverflow.com/questions/4823468/comments-in-markdown

Thoughts? I realize this may open a can of worms (setting variables in a MD document).

Contributor guide

Open the contributing guide

Research direction

No files, tests, or entry points are named in the issue. Start by locating MacDown's Markdown image-resolution path and reviewing how document-level metadata is handled; done means a document-specific base URL resolves relative image references without breaking existing Markdown behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos, markdown
Domain
desktop
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.