1.0.4 • Public • Published

Build Status

Highlight.js for Turbolinks 5

This is a Turbolinks 5 compatible fork of Highlight.js, and is up to date with v9.12.0.

To make Highlight.js compatible with Turbolinks 5, two event listeners have been added to initHighlightingOnLoad, which listen for the turbolinks:load and turbolinks:render events.

The original event listeners used by initHighlightingOnLoad have been left in place. They listen for the DOMContentLoaded and load events. This allows highlight-js-turbolinks to be compatible with applications that use turbolinks, and also compatable with applications that do not. Therefore if you ever choose to disable or remove turbolinks from your application, you may continue to use highlightjs-turbolinks.

Installing with Yarn and Rails

For Rails 5

Coming soon!

For Rails 5.1 and up

From your Rails root, run

yarn add highlightjs-turbolinks

Then add the following line to app/assets/javascripts/application.js

//= require highlightjs-turbolinks/lib/highlightjs-turbolinks.js

Then add the following line to app/assets/stylesheets/application.css

*= require highlightjs-turbolinks/styles/default.css


Highlightjs-turbolinks is released under the BSD License. See LICENSE file for details.


The official site for the original library is at https://highlightjs.org/.

Further in-depth documentation for the API and other topics is at http://highlightjs.readthedocs.io/.

Authors and contributors are listed in the AUTHORS.en.txt file.


npm i highlightjs-turbolinks

DownloadsWeekly Downloads






Last publish


  • ajwann