Skip to content

Markdown links to .md file open the source instead of the rendered markdown

Summary

When inserting a link to a .md file, for example [link](other-file.md), clicking on it will open the source code, instead of opening the page. I don't know if this is intentional, I see little use cases for it.

The documentation currently shows examples with the .md extension even though it doesn't work as expected.

What I see however, is that it breaks at least one workflow: when using Visual Studio Code to edit markdown, if you link to a .md file you can ctrl+clic on it to open the file (or create it if missing). With the markdown-authoring extension it will also highlight broken links. Both these features won't work with regular gitlab links such as [link](./other-file), that is, without the .md extension.

Another example: github opens the interpreted markdown when clicking a .md link, which means porting github files to gitlab won't work.

This comment summarizes the issue pretty well: #17845 (comment 214980983)

Steps to reproduce

  1. Create a wiki page
  2. Add for example a relative link to another page [link](other-page.md)
  3. Create the other-page.md file and write some markdown in it
  4. Navigate to your first page and click the link

What is the current bug behavior?

The source code of other-page.md appears

What is the expected correct behavior?

You should be directed to the wiki page "other-page", i.e. the interpreted markdown, not the source code

Output of checks

This bug happens on GitLab.com

Proposal

  • Redirect requests for /-/wikis/page.md to /-/wikis/page.
  • Introduce a dedicated raw action to get the page source, as we do for blobs in the project repository.
Edited by 🤖 GitLab Bot 🤖