MyST-Parser icon indicating copy to clipboard operation
MyST-Parser copied to clipboard

Inclusion of files with `:relative-images:`/`:relative-docs:` doesn't seem to work on links to images

Open Metadorius opened this issue 5 months ago • 1 comments

What version of myst-parser are you using?

4.0.0

What version dependencies are you using?

requirements.txt:

myst-parser==4.0.0
Sphinx==7.4.7
sphinx-rtd-theme==2.0.0
sphinx-design==0.6.1

.readthedocs.yaml:

# Set the version of Python and other tools you might need
build:
   os: ubuntu-24.04
   tools:
      python: "3.11"

What operating system are you using?

Linux

Describe the Bug

When including .md files from other directories, like README.md from the repo root, :relative-images:/:relative-docs: doesn't seem to work on links to images.

This is at the bottom my index.md:

```{include} ../README.md
:relative-docs: docs/
:relative-images:
```

Expected Behavior

The image should be linked properly.

To Reproduce

https://github.com/Phobos-developers/Phobos/pull/1765#discussion_r2203380505

Just link the image relatively to the included file like [link](path/to/image.png), not ![description](path/to/image.png).

The result:

https://phobos--1765.org.readthedocs.build/en/1765/#:~:text=%40TaranDahl%20(%E8%88%AA%E5%91%B3%E9%BA%BB%E9%85%B1)%20%2D%20T1%20maintainer

Image

Metadorius avatar Jul 16 '25 10:07 Metadorius

Uh the docs were updated, so there's no live example anymore. If needed I can make another example PR.

Metadorius avatar Jul 16 '25 11:07 Metadorius