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 deprecation warning in HTML #803

Closed
keorn opened this issue Mar 21, 2021 · 7 comments · Fixed by #804
Closed

highlight.js deprecation warning in HTML #803

keorn opened this issue Mar 21, 2021 · 7 comments · Fixed by #804

Comments

@keorn
Copy link
Contributor

keorn commented Mar 21, 2021

I noticed that recently pages built with template CI process display a deprecation notice above code blocks:

"Deprecated as of 10.7.0. highlight(lang, code, ...args) has been deprecated. Deprecated as of 10.7.0. Please use highlight(code, options) instead. highlightjs/highlight.js#2277"

@keorn keorn changed the title Deprecation warning in HTML of sites built with template CI process highlight.js deprecation warning in HTML Mar 21, 2021
@tlienart
Copy link
Owner

tlienart commented Mar 22, 2021

Thanks for the report!

For anyone stumbling upon this, for now just set prerender=false in the optimize call of the deploy script so

optimize(prerender=false)

@tlienart tlienart pinned this issue Mar 22, 2021
tlienart referenced this issue in JuliaLang/www.julialang.org Mar 22, 2021
@RoyiAvital
Copy link

Any reason not to move forward to the new version?

@abelsiqueira
Copy link
Contributor

If I understood correctly, when optimize(prerender=true) the new version is used because it's downloaded by node on deploy. The issue seems to be that somewhere in the code the deprecation log is captured. The optimize(prerender=false) uses the already downloaded highlight.js, which is the old version without the deprecation.

I tried to fix it, but it's out of my expertise, so eventually, I got lost. If you have any tips on where to look and/or how to verify it, I can try again.

@RoyiAvital
Copy link

I meant upgrading to the latest version of Highlight.js.

@tlienart
Copy link
Owner

Both will happen, I'm just under quite a lot of pressure at work at the moment so it's delaying updates here :)

I also want to be careful about not breaking things after a hurried RSS update which caused breakage 😣 (and which I still have to fix).

@tlienart
Copy link
Owner

tlienart commented Mar 24, 2021

@abelsiqueira sorry for not replying to your message, the line to change is

write(jsbuffer, """console.log("<pre><code class=\\"$lang hljs\\">" + hljs.highlight("$lang", "$cs").value + "</code></pre>");""")

(specifically the call hljs.highlight(...); the first message of highlightjs/highlight.js#2277 shows how to update it)

A PR with this would be very welcome, you'd have to test this separately though (i.e. run the optimize locally, and check that the appropriate HTML is generated + a screenshot of the result)

I think that should be all that is required.

@abelsiqueira
Copy link
Contributor

Thanks for the guidance @tlienart. I made the modifications in #804 and I also did tlienart/FranklinTemplates.jl#123. I haven't tested the templates change, though.

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

Successfully merging a pull request may close this issue.

4 participants