I've been having some problems getting the JavaScript prettify library to work on a project in VoltRb. The problem is that the code highlighting seems to work only when an error occurs and the page is reloaded. I think that the problem has something to do with Volt's persistent connection and that part of the problem is the prettify
script is not finding the elements it needs to find, and any custom themes are also having the same problem.
Here is a simple demo project demonstrating my issue: https://github.com/ylluminarious/code_prettify_volt
How can I get code highlighting working with prettify
in Volt?
As it turns out, prettify
is not a good solution for code-highlighting in Volt, as it is more geared for static apps. A better solution is highlight.js (since it is more geared for dynamic apps), which actually has been incorporated into a Volt component which works very well for all your highlighting needs.