Skip to content

Add rouge-ruby Comment.Doc style support

John Zhang requested to merge zsgsdesign/gitlab:master into master

What does this MR do and why?

Rouge Ruby, which GitLab uses as its highlighter, has introduced a Comment::Doc comment type many years ago, which uses class cd for highlight.

However, for a long time, neither Rouge nor any of its applicants added any style for this rather new type of comment, I believe it is mainly because only highlighted document comments using php, haskell, rust, r and lasso have it equipped.

I recently found this bug when the PHP doc did not work in the file view of our GitLab instance, earlier today I also submitted a PR fixing Rouge Dingus's style.

Screenshots or screen recordings

Wrong Highlight Behaviors Expected Behaviors / Result of this PR
Screenshot_2022-01-24_142357 Screenshot_2022-01-24_142901

How to set up and validate locally

Write the following PHP code:

<?php
class Test
{
    /**
     * This is a test.
     * @param int $base The base number.
     * @param int $step The step number to add to the base number.
     * @return int The sum of base and step numbers.
     */
    public function testing(int $base = 0, int $step = 1) :int
    {
        return $base + $step;
    }
}

The php doc section should look like this:

    /**
     * This is a test.
     * @param int $base The base number.
     * @param int $step The step number to add to the base number.
     * @return int The sum of base and step numbers.
     */

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 John Zhang

Merge request reports

Loading