Skip to content
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

Upgrade highlight.js in the highlight plugin to the latest version #2562

Closed
ggrossetie opened this issue Jan 8, 2020 · 7 comments
Closed

Comments

@ggrossetie
Copy link

The highlight plugin relies on Highlight.js 9.11.0.

I think we should use the latest version available 9.17.1: https://github.com/highlightjs/highlight.js/blob/master/CHANGES.md#version-9171

@ggrossetie
Copy link
Author

Actually the dev branch is using version 9.15.10 but the latest release of reveal.js (3.8.0) still rely on 9.11.0.

I found several issues on this subject, maybe we should not bundle highlight.js and/or provide a way to replace it with a newer version?

@Martinomagnifico
Copy link
Collaborator

Martinomagnifico commented Jan 28, 2020

I would also like to see more highlight.js options as options in the Reveal config. In my case I would like to change the tabReplace value. Right now, some options are passed, but not all.

Something like:

...
controls: false,
highlight: {
    tabReplace: '  '
},
dependencies: [
    { src: 'plugin/highlight/highlight.js' },
...

hakimel added a commit that referenced this issue Jan 29, 2020
@hakimel
Copy link
Owner

hakimel commented Jan 29, 2020

reveal.js 3.9 is out and includes highlight.js 9.18.0.

I agree it'd be great to make it easier to upgrade this separately. One of the appeals of reveal.js for many people is that it requires virtually no setup to get started—you can download the repo and edit the index.html file without needing to npm install or set up a web server. That said I'm cautious about making adding any extra steps to get something like code highlighting working. Loading from a CDN could be a good option.

@ggrossetie
Copy link
Author

reveal.js 3.9 is out and includes highlight.js 9.18.0.

Awesome, thanks @hakimel 👍

One of the appeals of reveal.js for many people is that it requires virtually no setup to get started—you can download the repo and edit the index.html file without needing to npm install or set up a web server

Indeed and I think we should keep it that way. Syntax highlighting should work out-of-the-box.

That said I'm cautious about making adding any extra steps to get something like code highlighting working. Loading from a CDN could be a good option.

We can use cdn.jsdelivr.net but this prebuilt version of highlight.js only contains the 34 most commonly used languages.
I can't find a prebuilt version of highlight.js that contains all the 175 languages. So it will be a "breaking change" even if it's pretty unlikely that you will need all the 175 languages in one presentation 😜

Please note that it's possible to load additional languages from https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/languages/.
We could provide an option to configure a list of additional languages that we want to load:

highlight: {
  languages: ['arduino', 'elm', 'x86asm'],
  tabReplace: '  '
}

@hakimel
Copy link
Owner

hakimel commented May 25, 2020

As of version 4.0 we no longer have a hard coded copy of highlight.js inside of the reveal.js repo. Instead highlight.js is installed as an npm dependency, which will make it much easier to upgrade going forward. We're currently using highlight.js 10.0.3.

I still think it'd be useful to let people configure a smaller subset of highlight.js languages to decrease the file size, or load highlight.js from another origin but this issue is ✅

@hakimel hakimel closed this as completed May 25, 2020
@FSMaxB
Copy link

FSMaxB commented Feb 28, 2021

@Martinomagnifico

I would also like to see more highlight.js options as options in the Reveal config. In my case I would like to change the tabReplace value. Right now, some options are passed, but not all.

I've found out a (hacky) way of settings highlight.js options directly:

const highlight_plugin = RevealHighlight();
highlight_plugin.hljs.configure({tabReplace: '    '});

And then pass highlight_plugin to the list of plugins instead of RevealHightlight.

@rparree
Copy link
Contributor

rparree commented Mar 22, 2021

I am using hugo and are loading reveal inside the html (using go module dependency). Is there a way to override the highlightjs version without using npm?

R0bes pushed a commit to R0bes/Terraform-Presentation that referenced this issue Jun 7, 2021
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

5 participants