hyperlinkgitlab

Why does URL of gitlab readme.md section not scroll to section?


To reproduce:

  1. Create a README.md file on gitlab repository.
  2. Create some headers in the file using #, and save it.
  3. Get the section link, e.g. scroll to the last header, and click the "link icon" beside it. The browser URL will show something like "https://.../README.md#my-last-header".
  4. Copy this URL and paste it in a new browser tab.
  5. It's supposed to display the file then scroll down to "my last header", but it doesn't scroll. It only displays the file at the top line of it.

Is that a bug?

How to get a URL to a section in Gitlab Reademe.md file that displays the file and scrolls to the section?

N.B. It works in github.

Thanks


Solution

  • The working link is got as following:

    https://gitlab.com/<user>/<project>/#my-last-section

    Assuming that the READEME.md is found on the project root folder directly.

    Instead of the link got when opening the readme.md file:

    https://gitlab.com/<user>/<project>/blob/main/README.md#my-last-section

    Which either has a bug, or is designed for that!