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

highlight.js version 9 used by AsciiDoctorJ needs update as it is out of support #1258

Closed
dhendriks opened this issue Jan 13, 2024 · 2 comments

Comments

@dhendriks
Copy link

When I use AsciiDoctorJ, and set source-highlighter to highlight.js, I get the following in the generated HTML:

...
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.3/styles/github.min.css"> <!--
...
  <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.3/highlight.min.js"></script>
  <script>
if (!hljs.initHighlighting.called) {
  hljs.initHighlighting.called = true
  ;[].slice.call(document.querySelectorAll('pre.highlight > code')).forEach(function (el) { hljs.highlightBlock(el) })
}
</script>
...

Version 9 of highlight.js is end-of-life and end-of-support (see highlightjs/highlight.js#2877).

And, the website at https://highlightjs.org/ only has documentation for the current version (version 11). I tried to add a new language to the version 9 one, but it doesn't work. It seems APIs have changed.

I then tried using the highlightjsdir option of AsciiDoctorJ to add CSS/JS of highlight.js version 11. That works for the linked CSS/JS files, but the last inline script part is still the same. The highlightBlock function that is used is deprecated. My browser indicates:

Deprecated as of 10.7.0. highlightBlock will be removed entirely in v12.0      highlight.min.js:108
Deprecated as of 10.7.0. Please use highlightElement now.                      highlight.min.js:108

Since it is only deprecated, it does function correctly, it seems. Still, I think it would be good to upgrade the highlight.js version used by AsciiDoctorJ, such that there are no deprecation warnings, and it is not necessary to include an own version of highlight.js just to get one that is supported.

@dhendriks dhendriks changed the title highlight.js needs update as it is out of support highlight.js version 9 used by AsciiDoctorJ needs update as it is out of support Jan 13, 2024
@abelsromero
Copy link
Member

It's tracked upstream asciidoctor/asciidoctor#3976

@dhendriks
Copy link
Author

It's tracked upstream asciidoctor/asciidoctor#3976

Thanks. I added a comment there.

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