The extra features like copy/paste and show language are provided by the highlighting library, in this case Prism.js. As far as I know, Highlight.js does not provide any similar features. So not possible at this time.
I hope this helps, let me know if I can provide any further infos.
Thread Starter
JM
(@makhijajatin)
Thanks,
I understand, but I have seen someone working on this using highlight.js + adding a copy button using clipboard.js. it works fine but it lacks powershell language support. Is it possible for you to add clipboard.js into highlight.js so that we can have a copy code button ?
https://github.com/srikat/WP-HighlightJS
Also does highlight.js provides inline code option as prism.js does ?
Third final one, I am using prism.js which works fine on the desktop but the code on the desktop does not work on mobile. Code theme works but for mobile there is no language support. Is it by design?
Glad to help:
1) “Is it possible for you to add clipboard.js into highlight.js so that we can have a copy code button ?”
It may be possible/feasible. I’ve added to the list and will take a look.
2) “Also does highlight.js provides inline code option as prism.js does ?”
Yes, pretty sure it does. Give it a try to find out for sure. Or check the docs should have more specific details.
3) “I am using prism.js which works fine on the desktop but the code on the desktop does not work on mobile. Code theme works but for mobile there is no language support. Is it by design?”
I have tested on iPhone, iPad, and Android devices — all working normally with default WordPress install. Most likely there is a theme or plugin conflict happening somewhere. Are you familiar with how to troubleshoot your setup?
Thread Starter
JM
(@makhijajatin)
Syntax highlighting module is better with highlight.js than prism.js. I like that one better.
Only things lacking in highlight.js is:
1. Display Language and Copy Button
2. Inline code – which I will have to test as Jeff said it works. So let’s see.
These two are more important and therefore I
am forced to use prism.js because prism.js displays language and copy code button + inline code. It’s syntax highlighter module is not great compared to highlight.js.
If you can fix these two issues then I will be thankful to you. I understand someone ask this question to you last year and you said you will look into it as it seems achievable.
Please check if it’s possible. Thank you. Much appreciate.its a great plugin.
-
This reply was modified 4 years, 7 months ago by
JM.
-
This reply was modified 4 years, 7 months ago by
JM.
I appreciate the feedback, @makhijajatin.
Will see what I can do for a future update.