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

Syntax highlighting working only on first occasion #1301

Closed
rtwk opened this issue Feb 20, 2018 · 24 comments
Closed

Syntax highlighting working only on first occasion #1301

rtwk opened this issue Feb 20, 2018 · 24 comments

Comments

@rtwk
Copy link

rtwk commented Feb 20, 2018

I am using PrismJS on my website for code blocks. Issue is, on Chrome on Windows 7, Syntax highlighting and line numbering working only on first occasion, so for next code blocks, it is not working. Surprisingly, it is working on Ubuntu + Chrome, Ubuntu + FF, Win 7 + FF. But since a lot of users use Chrome + Win 7, it is very odd looking. Any fix?

@Golmote
Copy link
Contributor

Golmote commented Feb 20, 2018

Hi! Can you provide on online example reproducing the issue, so that we can investigate, please?

@rtwk
Copy link
Author

rtwk commented Feb 20, 2018

For example, in this page - https://www.w3resource.com/python/python-list.php.

@mAAdhaTTah
Copy link
Member

This is caused by #1181. You need to update to the latest version.

@rtwk
Copy link
Author

rtwk commented Feb 20, 2018

Well, I did update to the latest version of Prism. It's PrismJS 1.11.0 (and corresponding css file is also updated). But the issue is yet to be fixed.

@Golmote
Copy link
Contributor

Golmote commented Feb 20, 2018

Are you sure you don't have some sort of cache? I just tested the link you gave in Chrome 64 on Windows 7 and could not reproduce this issue. (Unfortunately I did not have the chance to test it before you made the update, so I can't tell for sure the issue was reproduced before that point.)

@rtwk
Copy link
Author

rtwk commented Feb 20, 2018

Well, write you are. We have Cloudfare Cache. I am in Dev mode now and I see it is working. But, but,
line numbering and copy to clipboard are gone. I selected those two options while downloading the js and css code though. My code includes line-numbers class like <pre class="line-numbers"> and it used to come before I updated.

@Golmote
Copy link
Contributor

Golmote commented Feb 20, 2018

From the "redownload" URL that appears at the top of your prism.js file, I think you somehow did not include those plugins in your download (or the download page is broken, which would suck). Can you please try downloading it again and double check your selected plugins?

@mAAdhaTTah
Copy link
Member

Yeah, I'm not seeing the plugins in the JS served on your site.

@rtwk
Copy link
Author

rtwk commented Feb 20, 2018

Ok. Let me try it once again.

@rtwk
Copy link
Author

rtwk commented Feb 20, 2018

Strange problem. I actually select those two plugins. But since I can't see the download js and download css buttons, I have to select, copy and paste both js and css code manually. May be it is missing some code in the process.

@mAAdhaTTah
Copy link
Member

The download page produces a URL with everything you selected. Could you share that here?

@rtwk
Copy link
Author

rtwk commented Feb 20, 2018

Where it is? I found a button for downloading js but no button for css.

@mAAdhaTTah
Copy link
Member

In the CSS & JS files on the download page, you see the Prism version and a URL underneath it. That's the one I'm asking for.

@Golmote
Copy link
Contributor

Golmote commented Feb 20, 2018

Why can't you see the buttons?

The redownload URL is at the top of both the JS and the CSS files, as you can see partially selected in this screenshot:

https://i.imgur.com/H4AgOzY.png

@Golmote
Copy link
Contributor

Golmote commented Feb 20, 2018

Alright, this looks good to me. This is the content you need to download. You said you could not see the download buttons, why is that?

@rtwk
Copy link
Author

rtwk commented Feb 20, 2018

No idea. It comes when I load that url and disappears immediately.

@Golmote
Copy link
Contributor

Golmote commented Feb 20, 2018

Is it something that happens on one browser only or on all of them? Did you have the chance to try?

@rtwk
Copy link
Author

rtwk commented Feb 20, 2018

I tried both FF and Chrome. Both. Same.

@Golmote
Copy link
Contributor

Golmote commented Feb 20, 2018

This is really weird... I can't reproduce in any of them. If you manage to find any clue that could help us understand this new issue, please let us know! (Maybe an extension that you would have on both browsers? An antivirus thing maybe?)

Did you manage to copy-paste the code to make your page work properly again?

@rtwk
Copy link
Author

rtwk commented Feb 20, 2018

Nope. I think when I copy I am missing some code. So Line numbers are not coming.

@Golmote
Copy link
Contributor

Golmote commented Feb 20, 2018

Here you go: prism.zip

@rtwk
Copy link
Author

rtwk commented Feb 20, 2018

Perfect. It worked. Thanks a ton. May I close this issue?

@Golmote
Copy link
Contributor

Golmote commented Feb 20, 2018

Glad this is fixed. I'll close the issue. If you happen to understand the cause for the disappearing buttons, please let us know.

@Golmote Golmote closed this as completed Feb 20, 2018
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

3 participants