Thanks to visit codestin.com
Credit goes to github.com

Skip to content

How to set a font family for highlighjs component #55

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
SausageDogger opened this issue Mar 16, 2025 · 1 comment
Open

How to set a font family for highlighjs component #55

SausageDogger opened this issue Mar 16, 2025 · 1 comment

Comments

@SausageDogger
Copy link

SausageDogger commented Mar 16, 2025

I tried using CSS to set a font family for highlighted code ,but it didn‘t work.
I was confused because it seems that there is not an official way to set a font family for highlightJS
When I using native highlightJS and <pre><code>, .hljs it works

/* a div contained a highlightjs component */
#box{
  font-family: 'JetBrainsMono-Regular';
}

.highlightjs {
  font-family: 'JetBrainsMono-Regular';
}

.hljs {
  font-family: 'JetBrainsMono-Regular';
}
@joshgoebel
Copy link
Member

joshgoebel commented Mar 17, 2025

It's just CSS. Use the developer tool of your browser to find the correct element/class, and then just write the correct CSS.

When I using native highlightJS and <pre><code>, .hljs it works

I'd think this should work with the plugin as well. But if not, see above advice - perhaps there is a small diff.

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

No branches or pull requests

2 participants