Relative links in Markdown files don't work according to a spec if they point to files that don't exist in repo
- Given: Making changes to a Markdown file in a repo located at: https://example.com/dreamhost/virtkick/kubekick/blob/master/docs/50-troubleshooting.md
- When: Markdown link to URL
- Then: render HTML link to URL
- As per the spec at https://docs.gitlab.com/ee/user/markdown.html#links
- Actual: render HTML link to URL `https://example.com/dreamhost/virtkick/kubekick/master/docs/0-setup.md#step-5-inspect-logs``
Context: this ONLY happens if docs/0-setup.md doesn't exit in the repo. If docs/0-setup.md exists, the link is correct.
Steps to reproduce
- Edit any Markdown file in GitLab visual editor.
- Add anywhere:
[Kubekick guide, Inspect logs](/docs/0-setup.md#step-5-inspect-logs)
- Click Preview.
- Hover on the new link.
- Note the generated URL is missing the
Why it matters?
<DevilsAdvocate666> If I'm linking to a file that doesn't exist, why does it matter that the generated URL is still up to spec?
Because when I first make a mistake, and link to 0-setup.md instead of 10-setup.md, I'll check a link and it'll be invalid. If I spot lack of
/blob/ part in the link instead of my human typo
0, I'll think it's GitLab to blame, take down the company for GitLab upgrade (to make sure it's not a bug in GitLab), and when still not working, submit THIS ticket, only to realize that it was a typo at later point (but GitLab's inconsistency in generating links too).