Skip to content

[Bug]: From hightlight.js to Chroma, the font size rendering style is incorrect in the browser.#1807

@DejavuMoe

Description

@DejavuMoe

What happened?

The syntax highlighting style in the code block is incorrect with Hugo ChromaThis issue occurs on Google Chrome and Safari browsers on Android, macOS, and Windows 11.
Image

Image

可以复现的网页:

Steps to reproduce

What have I done?

I have read:
I made the following changes to the Hugo configuration:
  • Disable Highlight.js in hugo.yaml
params: assets: disableHLJS: truepygmentsUseClasses: true ... markup: ...highlight: noClasses: falseanchorLineNos: truecodeFences: trueguessSyntax: truelineNos: truestyle: dracula
  • Gen a Chroma CSS style
hugo gen chromastyles --style dracula --highlightStyle 'bg:#1c1d21'> assets/css/extended/dracula.css
  • Add custom css style (assets/css/extended/custom.css)
.chroma{background-color: unset} /* Fixes iOS font sizing anomaly */code{text-size-adjust:100%; -ms-text-size-adjust:100%; -moz-text-size-adjust:100%; -webkit-text-size-adjust:100%}

Hugo Version

Hugo >= 0.146.0 (Recommended - Minimum version required for PaperMod)

PaperMod Version

c98a924

What kind of devices are you seeing the problem on?

Desktop

What browsers are you seeing the problem on?

Chrome

Browser Version

Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Mobile Safari/537.36

Relevant log output

There were no log errors or console reports when building the Hugo website.

Repository/Source Code link where this issue can be reproduced

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions