Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

Fix syntax highlighting issues with Chroma #145

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

salvalcantara
Copy link

@salvalcantara salvalcantara commented Jan 4, 2020

Minor changes along the lines of https://themes.gohugo.io/beautifulhugo/ for supporting both highlight.js (theme-default) and chroma (hugo-native) highlighting solutions:

  • To use highlightling.js, use these settings within config.toml:
pygmentsCodeFences = false
pygmentsUseClasses = false

[params]
highlightjs = true
  • To rely on Chroma instead:
pygmentsCodeFences = true
pygmentsUseClasses = true

[params]
highlightjs = false

Using the new server side syntax highilighting provided by Chroma requires generating an additional CSS file. For example, for styling according to the trac theme, one would run:

hugo gen chromastyles --style=trac > static/css/syntax.css
  • The main.css file has been changed to properly display the horizontal scrollbar in code fences when using Chroma for syntax highlighting.
  • The README has been updated to point to the contributing guidelines.

@salvalcantara salvalcantara changed the title Fix syntax highlighting issues with chroma Fix syntax highlighting issues with Chroma Jan 4, 2020
@@ -523,6 +523,9 @@ div.main .content .markdown h6 {
margin-bottom: 1rem;
letter-spacing: none;
}
pre {
overflow-x: auto;
}
div.main .content .markdown code,
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Required for displaying the horizontal scrollbars in code snippets that exceed the maximum width. The change is necessary only for the Chroma case, but it does not break anything in the highlighting.js case.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant