Skip to content

Added support for links to markdown file code lines

What does this MR do and why?

Related to #15036 (closed).

I, @leetickett and @espadav8 worked on this MR during one of our pairing sessions.

This MR tries to solve the problem described in the related issue, where URLs that point to a code line of a markdown file won't get actually handled because the markdown file is getting rendered.

Screenshots or screen recordings

README.md___master___Flightjs___Flight___GitLab_-Personale-_Microsoft__Edge_2022-07-05_17-53-38

How to set up and validate locally

There are a couple of things to check:

  • the plain value on the URL is getting used
    1. Go to a project with markdown file, e.g. the Flight project
    2. Open a markdown file, e.g. README.md
    3. Switching from rich view to code-behind will add/update the plain element on the query string of the URL
    4. Copying the URL with the plain value set to 1 and pasting it on a new tab should show the code behind of the markdown file, not the rich view
    5. Copying the URL with the plain value set to 0 and pasting it on a new tab should show the rich view
    6. When a file does not have a rich view, the plain value is ignored
  • an URL to a markdown file code line and the plain value set to 1 should highlight and scroll to the selected line
    1. Go to a project with markdown file, e.g. the Flight project
    2. Open a markdown file, e.g. README.md
    3. Switch to the code-behind view
    4. Get a permalink to a code line
    5. Copy the URL to a new tab
    6. The file should get rendered showing its code-behind and highlight and scroll to the selected line

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Marco Zille

Merge request reports