豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

use image paths relative to md file#45

Open
prozessorkern wants to merge 2 commits intoomnilib:mainfrom
prozessorkern:feature/use-image-paths-relative-to-md-file
Open

use image paths relative to md file#45
prozessorkern wants to merge 2 commits intoomnilib:mainfrom
prozessorkern:feature/use-image-paths-relative-to-md-file

Conversation

@prozessorkern
Copy link
Copy Markdown

Description

we use this plugin to include readme.md files into the sphinx documentation.
In this usecase used images are referenced relative to the *.md file - currently sphinx will not be able to find those files.

With this fix sphinx will search for images relative to the md file.

@michimussato
Copy link
Copy Markdown

Merge please.

@amyreese
Copy link
Copy Markdown
Member

amyreese commented Feb 3, 2025

Would be nice to include some test cases or expected inputs/outputs.

Comment on lines +232 to +234
image_path = os.path.join(os.path.dirname(self.mdinclude_path), src).replace(
"\\", "/"
)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to see this using pathlib and proper separator normalization rather than string replacements.

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.

4 participants