On prism.js official site there is a section called "Third-party tutorials"
https://prismjs.com/#tutorials
There you can there are some linked articles on how to use prism.js with ajax returns, angular or react:
- https://schier.co/blog/how-to-re-run-prismjs-on-ajax-content
- https://auralinna.blog/post/2017/code-syntax-highlighting-with-angular-and-prismjs
- https://itsmycode.com/prismjs-tutorial/
The idea is that stock configuration is only called on page load, which on a SPA only happens once on the first load, and not with internal navigation.
So you need to somehow hook at route changes (you didn't share which SPA architecture you are using, nor I am an expert on all front-end technologies), and re-run prism.js to account for new content injected into the DOM.
Good luck!
