Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B bootstrap
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 263
    • Issues 263
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 114
    • Merge requests 114
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Bootstrap
  • bootstrap
  • Merge requests
  • !36173

Fix Chroma line highlight style

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Julien Déramond requested to merge github/fork/julien-deramond/main-jd-fix-chroma-syntax-highlighter into main Apr 14, 2022
  • Overview 3
  • Commits 1
  • Pipelines 0
  • Changes 1

This PR proposes to fix the typo of the class for the line highlight: .hl → .hll (I've checked the other classes and they seem OK).

ℹ Nice to know, it is possible to retrieve the list of classes (and meaning) by executing hugo gen chromastyles > chroma.css ; cat chroma.css

The following examples can be reproduced by integrating the following code in one of our Markdown pages:

{{< highlight go "linenos=table,hl_lines=8 15-17,linenostart=199" >}}
// GetTitleFunc returns a func that can be used to transform a string to
// title case.
//
// The supported styles are
//
// - "Go" (strings.Title)
// - "AP" (see https://www.apstylebook.com/)
// - "Chicago" (see https://www.chicagomanualofstyle.org/home.html)
//
// If an unknown or empty style is provided, AP style is what you get.
func GetTitleFunc(style string) func(s string) string {
  switch strings.ToLower(style) {
  case "go":
    return strings.Title
  case "chicago":
    return transform.NewTitleConverter(transform.ChicagoStyle)
  default:
    return transform.NewTitleConverter(transform.APStyle)
  }
}
{{< / highlight >}}

Before

(Nothing is highlighted)

Screenshot from 2022-04-14 19-09-07

With the modification

Screenshot from 2022-04-14 19-08-43

IMO white highlight is very difficult to see, so I tried in this PR --base02: #c8c8fa. Here is the rendering:

Screenshot from 2022-04-14 19-08-55

I'm not sure about the contrast and the color but that seemed the best choice regarding the available color palette. If not we could introduce in the color palette of this file a light yellow 🤷

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/julien-deramond/main-jd-fix-chroma-syntax-highlighter