Created by @jahudka in Forum News

To my knowledge, until recently no JS-based syntax highlighters supported neither Latte nor Neon. That's why the forum didn't have any syntax highlighting at all - since I suppose most code snippets that we can expect on this forum would be Latte, they'd suffer from either bad syntax highlighting (because we'd use e.g. Smarty highlighting) or no highlighting at all. Neither of those options were acceptable to me, but having no syntax highlighting at all feels equally awkward on a forum focused on programming.

So I went ahead and implemented Neon and Latte support for Prism. I tried with Highlight.js first, and I made a PR with a passable Neon implementation there as well, but due to some limitations in how Highlight.js's parser works it's impossible to properly support Latte there (or at least I couldn't do it). Prism does things a little differently, so I had better success there. So there are now two PRs from me at Prism's Github awaiting approval. But you, my dear reader, can benefit from these implementations now! For starters this forum now highlights code blocks in posts (provided they tag the language appropriately) and you can also use my fork of PrismJS in your projects - just add "prismjs": "" to your package.json and run npm i prismjs; usage after this point is the same as if you installed the official PrismJS package through NPM.

Feel free to ping me with any issues you find!

Sign in to post a reply