How ForkJoy Implemented AJAX Page Loads

This article will provide a fairly high level overview of how ForkJoy implemented its AJAX page loading system. ForkJoy uses Node.js and Express for its backend, Jade for templating, and JQuery on the frontend. Disclaimer The sample code used in this article is based on the ForkJoy codebase, but is heavily simplified to reduce complexity. The purpose of the sample code is not to provide a working demo, but to provide a starting point for implementation and help the readers’ understanding.

How To Re-Run Prism.js On AJAX Content

Prism.js is a great library to handle syntax highlighting for code blocks on a web page. However, since Prism runs automatically after being embedded (hence why you need to include it at the bottom of the HTML) content that is loaded later is not highlighted. After console logging the Prism object in Chrome developer tools I discovered a method called highlightAll() which can be used to force Prism to rerun on the current page.