Simple syntax highlighting library written in javascript
APACHE-2.0 License
Bot releases are visible (Hide)
Published by ccampbell about 4 years ago
Published by ccampbell about 4 years ago
Published by ccampbell over 6 years ago
Published by ccampbell over 7 years ago
new
keyword could be highlighted inside a string (#202)Published by ccampbell about 8 years ago
Published by ccampbell about 8 years ago
Published by ccampbell over 8 years ago
$
was not correctly highlighted all the timeRainbow.remove
Published by ccampbell over 8 years ago
Rainbow 2.0 is basically a complete rewrite from the ground up. Here is a summary of most of the changes
Updated code highlighting to use webworkers to prevent the main thread from being blocked while processing code blocks
Added support for Node.js
Added Rainbow.colorSync
method for synchronous highlighting (only for node.js)
Refactored source code into ES6 modules (using buble + rollup for compilation)
Updated unit tests to run via Karma
Added ES6 support to the JavaScript language grammars
Updated themes to use SASS to share common logic
Added SASS mixin to make it easy to add custom rules to specific languages
Updated themes to wait until code is highlighted before displaying it to prevent a flash of unstyled content (FOUC)
Added a preload animation for when the code takes some time to highlight
Updated code highlighting for each block to be self contained. Previously there was a global state that led to some obscure bugs.
Fixed race condition where calling Rainbow.color
while another Rainbow.color
call is running could cause some strange behavior
Added ability for a language to extend any other language.
For example you could add a language grammar for jsx
that inherits all the rules from javascript
while javascript
inherits all the rules from generic.
.
Updated build process to run using gulp to simplify creating custom packages
Updated build to use Uglify instead of closure compiler
Added ability to defer highlighting so it does not happen immediately on page load
Removed Rainbow.addClass
method
Updated Rainbow.extend
to no longer extend generic
patterns by default
This means that passing true
as the second argument is no longer needed. Instead if you pass a language as the second argument the rules will extend that language.
Dropped support for older versions of Chrome/Firefox/IE.
Check README.md for list of supported browsers.