Skip to content

Code nav: Accept tokens instead of raw HTML on FE

Igor Drozdov requested to merge id-code-nav-accept-tokens-instead-of-html into master

What does this MR do?

Render tokens instead of raw HTML for code navigation popover. The tokens are two-dimensional array of objects:

{
  class null/string
  value string
}
        "definition_path": "cmd/check/main.go#L7",
        "hover": [
            {
                "language": "go",
                "tokens": [
                    [
                        {
                            "class": "kn",
                            "value": "package"
                        },
                        {
                            "value": " "
                        },
                        {
                            "class": "s",
                            "value": "\"gitlab.com/gitlab-org/gitlab-shell/internal/command\""
                        }
                    ]
                ]
            }
        ],

If the object contains class we render a span; otherwise, we render it as a raw text

Related issue: #218253 (closed)

BE issue: gitlab-workhorse!517 (merged)

Edited by Igor Drozdov

Merge request reports