-
Notifications
You must be signed in to change notification settings - Fork 227
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
Fix unneeded highlight CSS, fix disable_highlight, clean up highlight template #135
base: master
Are you sure you want to change the base?
Conversation
There is an extra call to |
I didn't see that. I'll make the change and update the PR. |
layouts/partials/footer.html
Outdated
<script src="{{ $highCDN }}/highlight.js/{{ $highVer }}/highlight.min.js"></script> | ||
{{ if (and (not .Site.Params.disable_highlight) (not .Params.disable_highlight)) }} | ||
{{ $highVersion := .Site.Params.highlightjsVersion | default "9.12.0" }} | ||
{{ $highCDN := .Site.Params.highlightjsVersion | default "//cdn.bootcss.com" }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be highlightjsCDN
.
layouts/partials/header.html
Outdated
{{ if (and (not .Site.Params.disable_highlight) (not .Params.disable_highlight)) }} | ||
{{ $highTheme := .Site.Params.highlightjsTheme | default "github" }} | ||
{{ $highVersion := .Site.Params.highlightjsVersion | default "9.12.0" }} | ||
{{ $highCDN := .Site.Params.highlightjsVersion | default "//cdn.bootcss.com" }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be highlightjsCDN
.
One more thing I noticed is that bootcss CDN doesn't work for me anymore. I have to use cloudflare instead. |
Fixed. Although I realized shortly after making this originally, hugo has builtin syntax highlighting. So is this really necessary? |
@lfkeitel Good point. I don't know that. Does the built-in syntax highlight support source code in my posts (md files)? If so, I agree we'd better use the built-in one. |
@hjiawei yea: https://gohugo.io/content-management/syntax-highlighting/. It uses shortcodes to mark code sections. You can even highlight specific lines for emphasis. You can set a theme and use inline styles or a separate style sheet that hugo can generate for you. It's very powerful. Most importantly, it removes any runtime Javascript for the highlighting since it's all pre-processed. |
Description
Use default values of "github" for theme and 9.12.0 for version. Allow highlights to be disabled globally or per page.
Motivation and Context
Closes #131.
How Has This Been Tested?
Tested manually.
Hugo Version: 0.37.1
Browser(s): Chrome
Screenshots (if appropriate):
Types of changes
Checklist:
theme.toml
, accordingly.