hugo-future-imperfect icon indicating copy to clipboard operation
hugo-future-imperfect copied to clipboard

Fix unneeded highlight CSS, fix disable_highlight, clean up highlight template

Open lfkeitel opened this issue 6 years ago • 6 comments

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

  • [x] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • [x] My code follows the code style of this project.
  • [ ] My change requires a change to the documentation.
  • [ ] I have updated the documentation, including theme.toml, accordingly.
  • [x] I have read the Contributing Document.

lfkeitel avatar Mar 30 '18 02:03 lfkeitel

There is an extra call to hljs.initHighlightingOnLoad near the bottom of footer.html that should be removed because it will fail with disable_highlight.

rabbitfang avatar Apr 12 '18 03:04 rabbitfang

I didn't see that. I'll make the change and update the PR.

lfkeitel avatar Apr 12 '18 03:04 lfkeitel

One more thing I noticed is that bootcss CDN doesn't work for me anymore. I have to use cloudflare instead.

hjiawei avatar May 03 '18 13:05 hjiawei

Fixed. Although I realized shortly after making this originally, hugo has builtin syntax highlighting. So is this really necessary?

lfkeitel avatar May 03 '18 13:05 lfkeitel

@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 avatar May 03 '18 13:05 hjiawei

@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.

lfkeitel avatar May 03 '18 14:05 lfkeitel