Labels are not rendered correctly in the markdown preview in the repository

Summary

Scoped labels are not rendered correctly in the markdown preview in the Code > Repository.

This issue happens in the both main branch and other branches. And the both README.md and other markdown files. For example:

  • https://gitlab.com/kkamiya_gl/600222-test-project/-/blob/main/README.md
  • https://gitlab.com/kkamiya_gl/600222-test-project/-/blob/test-branch/foobar.md)

On the other hand, this issue does not happen in other pages. For example:

  • https://gitlab.com/kkamiya_gl/600222-test-project
  • kkamiya_gl/600222-test-project#1

When I tested it on my test environment of self-managed instances, this issue can be replicated in the 17.7.3, but not replicated in the 17.7.2

Steps to reproduce

  1. Create a project

  2. Define scoped labels in the Manage > Labels

    image.png

  3. Update README.md as follows

    # scoped labels test
    
    ~scoped::label
    
    ~foo::bar
  4. Confirm that the scoped labels are not rendered correctly

    image.png

  5. If we check the markdown from the project overview page, scoped labels rendered correctly

    image.png

Example Project

https://gitlab.com/kkamiya_gl/600222-test-project

What is the current bug behavior?

Scoped labels are not rendered correctly

image.png

What is the expected correct behavior?

Scoped labels are not rendered as same as the project overview, issue, etc.

image.png

image.png

Relevant logs and/or screenshots

  • HAR file 1 (Issue happened in the https://gitlab.com/kkamiya_gl/600222-test-project/-/blob/main/README.md?ref_type=heads)
    • isue_happened.har
  • HAR file 2 (Issue not happened in the https://gitlab.com/kkamiya_gl/600222-test-project)
    • issue_not_happened.har

Output of checks

This bug happens on GitLab.com

Results of GitLab environment info

Expand for output related to GitLab environment info
This bug happens on GitLab.com

Results of GitLab application Check

Expand for output related to the GitLab application check
This bug happens on GitLab.com

Possible fixes

Edited Jan 28, 2025 by Kosuke Kamiya
Assignee Loading
Time tracking Loading