-
Notifications
You must be signed in to change notification settings - Fork 2
Relative links in markdown files resolve against temp directory instead of source file location #19
Description
When a markdown file containing relative links is opened in MDLook, clicking those links navigates to a temp directory rather than the linked file.
Steps to reproduce:
- Create two markdown files in the same directory, e.g. index.md and other.md
- Add a relative link in index.md: other
- Open index.md in MDLook (Read mode)
- Click the link
Expected behaviour:
MDLook opens other.md from the same directory as index.md.
Actual behaviour:
MDLook attempts to resolve the link relative to a temp directory, so the file is not found.
Root cause (suspected):
MDLook likely renders markdown by generating a temporary HTML file and loading that into WebView2. If the WebView2 Source URL is set to the temp file's path rather than the original file's directory, relative links will resolve against the wrong base path. Setting the navigation base URL to the directory of the source .md file should fix this.
Context:
Relative links between markdown files are a standard documentation pattern (used by GitHub, VS Code, Obsidian, etc.). Having them work correctly would make MDLook viable for multi-file documentation sets and wikis.